Got test login message working.
This commit is contained in:
parent
276f128bb9
commit
09c309699f
2 changed files with 6 additions and 3 deletions
|
|
@ -56,6 +56,8 @@ int main(int argc, char *argv[]) {
|
|||
if (errflag < 0)
|
||||
err__crash("Failed to connect to host");
|
||||
|
||||
msg__login_req(sockfd, "username", "passwd");
|
||||
|
||||
while (1) {
|
||||
bzero(msgbuffer, sizeof msgbuffer);
|
||||
fgets(msgbuffer, sizeof msgbuffer, stdin);
|
||||
|
|
|
|||
|
|
@ -12,12 +12,9 @@
|
|||
#include <sys/types.h>
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
int a = 1;
|
||||
|
||||
// Set up containers for file descriptor id's
|
||||
int serv_sockfd, cli_sockfd, portno, errflag;
|
||||
char msgbuffer[255];
|
||||
|
||||
// Set port number.
|
||||
if (argc > 1) {
|
||||
portno = atoi(argv[1]);
|
||||
|
|
@ -33,9 +30,13 @@ int main(int argc, char *argv[]) {
|
|||
// Create socket
|
||||
serv_sockfd = msg__create_serv_connection(portno);
|
||||
|
||||
|
||||
// Accept connection
|
||||
cli_sockfd = msg__accept_cli_connection(serv_sockfd);
|
||||
|
||||
// Require login as first request
|
||||
msg__handle_login(&serv_sockfd);
|
||||
|
||||
while (1) {
|
||||
// Empty message buffer
|
||||
bzero(msgbuffer, sizeof msgbuffer);
|
||||
|
|
|
|||
Loading…
Reference in a new issue