This is my first attempt playing with sockets and I am just working with some sample code that I got to compile. For some reason however this loop in my code hangs after the first execution. Any ideas why?
this is the output I get:Code:while (recv(theSocket, szBuf, 255, 0) > 0) { cout << " -- " << szBuf << "\n"; memset(szBuf, 0x0, 255); // set line to all zeroes strcpy(szBuf, "fmstdnt2"); cerr << "Sent: " << szBuf << " to server.\n"; // Send converted line back to client. if (send(theSocket, szBuf, strlen(szBuf), 0) < 0) cerr << "Error: cannot send modified data"; memset(szBuf, 0x0, 255); // set line to all zeroes cerr << "Zeroed buffer.\n"; } cout << "Exited loop!\n";
Code:Stream Client connecting to server: xxx.xxx.xxx.xxx on port: 23 -- ²$ Sent: fmstdnt2 to server. Zeroed buffer.



LinkBack URL
About LinkBacks


