So at the moment I have coded a sever which uses select() to find active sockets, reads from them and then takes the data recv'd and sends it back out to all connected clients appart from the sender.
I have a talker which just spits out hello to the server.
The problem I have is that when I call recv on the client, the client just hangs. I can see that the client connects to the server and everything seems fine. I can get data flowing to the server and out of the server but I cant seem to get it recv'ed by the client.
I can use telnet as a client and it seems to work fine with the server. all sends and recv's get to the right places.
Here is the code I have for the program recving. the output of the program is just
"Reciver: In For loop"
And then it hangs.
I suggest looking at the sender side. Apart from the syntax error on line 12 (which I assume is a cut-paste
error and that this code actually compiles), the receiver code looks OK. (I assume p is a pointer to
rcv[0], but even if not, you should at least see some output from line 13).
The I have quite throughly, its a fairly simple loop which loops select for incoming connections / data, processes the connection, then sends the data on.
The reason I don't think it is server side is because as I said before. If I start the server and connect with telnet from two other machines sending and reciving from each machine works.
p is a pointer to rcv.
(and yeh I noticed ln12 after I hit compile )
really? That might explain it, rcv is 256 chars. I'm only sending 5 chars each time. so maybe I should just leave it running overnight and have a look see in the morning to see if there is any change.