#include <iostream>
#include <cstdlib>
#ifdef CCXX_NAMESPACES
using namespace std;
using namespace ost;
#endif
{
protected:
public:
};
{
cout << "binding segsize: " << getSegmentSize() << endl;
}
{
cout << "accepting from: " << ia << ":" << port << endl;;
return true;
}
int main(int argc, char *argv[])
{
int i;
addr = "255.255.255.255";
cout << "testing addr: " << addr << ":" << 4096 << endl;
addr = "127.0.0.1";
cout << "binding for: " << addr << ":" << 4096 << endl;
Thread::setException(Thread::throwException);
try {
myTCPSocket server(addr);
while(server.isPendingConnection(30000)) {
tcp <<
"welcome to " << addr <<
"; segment size=" << tcp.
getSegmentSize() << endl;
tcp <<
"connected from " << tcp.
getPeer(&port) << endl;
if(tcp.
isPending(Socket::pendingInput, 2000)) {
tcp >> i;
tcp << "user entered " << i << endl;
}
tcp << "exiting now" << endl;
}
}
catch(SockException& e) {
cout << e.getString() << ": " << e.getSystemErrorString() << endl;
exit(-1);
}
cout << "timeout after 30 seconds inactivity, exiting" << endl;
return 0;
}