Hi,
I have a challenge to get sockets to work, I gave up the DatagramSocket and now have tried out the StreamingSocket class. The code fails at the const int newSocket = (int) accept (handle, &address, &len); statement, so that code after this statement does not execute and my program does wierd things. Wonder what could cause this problem?
regards,
Rune
StreamingSocket* StreamingSocket::waitForNextConnection() const
{
jassert (isListener || ! connected); // to call this method, you first have to use createListener() to
// prepare this socket as a listener.
if (connected && isListener)
{
struct sockaddr address;
#if defined (JUCE_LINUX) || (defined (JUCE_MAC) && ! MACOS_10_2_OR_EARLIER)
socklen_t len = sizeof (sockaddr);
#else
int len = sizeof (sockaddr);
#endif
const int newSocket = (int) accept (handle, &address, &len);
if (newSocket >= 0 && connected)
return new StreamingSocket (inet_ntoa (((struct sockaddr_in*) &address)->sin_addr),
portNumber, newSocket);
}
return 0;
}