24 std::string mode(argv[1]);
29 int client_descriptor = server.
Accept();
30 std::cout <<
"Accepted connection on descriptor: " << client_descriptor
38 bool do_output =
false;
39 bool do_input =
false;
43 int nio = setman.
Select(4.0);
46 std::cout <<
"Client has input to process." << std::endl;
48 std::cout <<
"Receiving message number " << ++nrecv
49 <<
" from client." << std::endl;
50 std::string clientstring;
51 std::getline(clientInStr,clientstring);
52 std::cout <<
"Client sent: " << clientstring << std::endl;
53 if(clientstring.find(
"final") != std::string::npos)
56 clientOutStr <<
"Server recvd " << nrecv <<
", sent " 57 << ++nsend << std::endl;
59 clientOutStr <<
"Server recvd " << nrecv <<
", send " 60 << ++nsend <<
" <final>" << std::endl;
67 std::string host(argv[2]);
70 std::cerr <<
"Client failed to connect to " << host << std::endl;
73 std::cout <<
"CLient is connected to " << host <<
" on " 79 fdOut <<
"I am the client, and this is my initial message." << std::endl;
84 bool done_sending =
false;
90 std::cout <<
"Ready to receive message " << ++nrecv
91 <<
" from server." << std::endl;
93 std::getline(fdIn,line);
95 std::cout <<
"line(" << ++nlines <<
") from server: " << line << std::endl;
97 std::cout <<
"No line received." << std::endl;
99 std::cout <<
"Sending message " << ++nsend <<
" to server." << std::endl;
100 fdOut <<
"I am the client, and I am sending message number " << nsend
106 std::cout <<
"Sending final" << std::endl;
107 fdOut <<
"final" << std::endl;
112 std::cout <<
"These lines were left over: " << std::endl;
114 while(std::getline(fdIn,line))
115 std::cout << line << std::endl;
int SimpleInit(int port=0)
int Select(float seconds=0.0, bool reset=true)
int Connect(const std::string &server_address, int port=0)
int AddIODescriptor(int infd)
Defines MPI-specific parallel global and program classes.
int AddInDescriptor(int infd)
int TestTCPInterface(int argc, char *argv[])
Test utility for the TCP Interface.
int main(int argc, char *argv[])
int ReadyForOutput(int infd=-1)
TCP/IP Network Utilities Interface.
Unix System Tools interface.
int ReadyForInput(int infd=-1)
Implementation of stream object for Unix file descriptors.