Thread: Socket Server
View Single Post
Old May 22nd, 2006, 6:16 PM   #10
hbe02
Hobbyist Programmer
 
hbe02's Avatar
 
Join Date: Mar 2006
Location: Lebanon
Posts: 148
Rep Power: 3 hbe02 is on a distinguished road
Harakim: i think your problem is with checking the error condition.. for example with send.. it returns the length of the string your sending..
for example if you send the string "Hello" which is of size 5.
then if (send == 5) no error occurs... else an error occured..
im not very sure about the recieving case.. but the recieve function should return one of 2 values.. returns 0 if error occured and -1 when there was no error.. so if (recieve == -1) no error.. else an error occured..

Alright i have a question on sockets.. lets say i want to listen on a socket.. or wait for data to be sent.. and at the same time run some code.. i want to print numbers 1 to infinity . i.e keep incrementing and print..and then when i recieve a message on the socket. the function halts and some other operation is executed..
hbe02 is offline   Reply With Quote