Hi guys
I'm trying to run a simple server-client program on the iphone. The server and client are 2 different threads. Basically the server is supposed to send "hello world" to the client, and the client should print it. The server sends it like so:
send(new_fd, "Hello, world!", 13, 0);
The client receives it like that:
if ((numbytes = recv(sockfd, buf, MAXDATASIZE-1, 0)) == -1) {
perror("recv");
exit(1);
}
buf[numbytes] = '\0';
printf("client: received '%s'\n",buf);
The complete server code is here http://beej.us/guide/bgnet/output/html/multipage/clientserver.html#simpleserver And the client code: http://beej.us/guide/bgnet/output/html/multipage/clientserver.html#simpleclient
In the simulator the client indeed prints "client: received hello world", but when I run on the device it prints nothing (client: received '') so something is wrong with the send or receive function.
please help
Alex