Small changes that were never comitted.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9317 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
def78b567a
commit
e35b498755
@ -9,11 +9,11 @@
|
||||
#include "arpa/inet.h"
|
||||
#include "sys/select.h"
|
||||
|
||||
#include "ufunc.h"
|
||||
// #include "ufunc.h"
|
||||
|
||||
#define PORT 7772
|
||||
#define HELLO_MSG "Hello from the server"
|
||||
#define RESPONSE_MSG "Hello from the client!"
|
||||
#define HELLO_MSG "Hello from the server\n"
|
||||
#define RESPONSE_MSG "Hello from the client!\n"
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
@ -24,31 +24,31 @@ int main(int argc, char **argv)
|
||||
int newsock;
|
||||
char buffer[50];
|
||||
|
||||
test_banner("Accept Test - Server");
|
||||
// test_banner("Accept Test - Server");
|
||||
|
||||
memset(&sin, 0, sizeof(sin));
|
||||
sin.sin_family = AF_INET;
|
||||
sin.sin_port = htons(PORT);
|
||||
sin.sin_len = salen;
|
||||
sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
|
||||
sin.sin_addr.s_addr = htonl(INADDR_ANY); // LOOPBACK);
|
||||
rv = bind(sock, (const struct sockaddr*)&sin, salen);
|
||||
if (rv < 0)
|
||||
err(rv, "bind");
|
||||
perror("bind");
|
||||
printf("Bound\n");
|
||||
|
||||
rv = listen(sock, 5);
|
||||
if (rv < 0)
|
||||
err(rv, "listen");
|
||||
perror("listen");
|
||||
printf("Listening\n");
|
||||
|
||||
newsock = accept(sock, (struct sockaddr*)&sin, &salen);
|
||||
if (newsock < 0)
|
||||
err(newsock, "accept");
|
||||
perror("accept");
|
||||
printf("Accepted socket %d\n", newsock);
|
||||
|
||||
rv = write(newsock, HELLO_MSG, strlen(HELLO_MSG));
|
||||
if (rv < 0)
|
||||
err(rv, "write");
|
||||
perror("write");
|
||||
printf("Written hello\n");
|
||||
|
||||
close(newsock);
|
||||
|
Loading…
Reference in New Issue
Block a user