D
Daniel Draper
Hi,
I have a written a simple client server app using sockets in c. My
client code works great for a single send/recv operation but as soon
as I try to write (send) to the same socket again the server does not
receive the data.
My client code looks like this:
sock = make_socket (PORT);
for (i = 0; i < 2; i++)
{
send(sock, MESSAGE, strlen(MESSAGE) + 1, 0);
n = recv(sock, buf, sizeof(buf), 0);
if (n > 0)
printf("server echoed %s\n", buf);
}
close(sock);
First iteration works, but second fails.
Any ideas?
Daniel
I have a written a simple client server app using sockets in c. My
client code works great for a single send/recv operation but as soon
as I try to write (send) to the same socket again the server does not
receive the data.
My client code looks like this:
sock = make_socket (PORT);
for (i = 0; i < 2; i++)
{
send(sock, MESSAGE, strlen(MESSAGE) + 1, 0);
n = recv(sock, buf, sizeof(buf), 0);
if (n > 0)
printf("server echoed %s\n", buf);
}
close(sock);
First iteration works, but second fails.
Any ideas?
Daniel