"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "html/muscle-by-example/examples/reflector/example_2_dumb_client.cpp" between
muscle8.20.zip and muscle8.30.zip

About: MUSCLE (Multi User Server Client Linking Environment) is a messaging server and networking API. The included server program ("muscled") lets its clients message each other, and/or store information in its serverside hierarchical database.

example_2_dumb_client.cpp  (muscle8.20):example_2_dumb_client.cpp  (muscle8.30)
skipping to change at line 104 skipping to change at line 104
SetConsoleLogLevel(MUSCLE_LOG_DEBUG); SetConsoleLogLevel(MUSCLE_LOG_DEBUG);
// This object contains our client program's event loop. // This object contains our client program's event loop.
// (Yes, even though it says 'Server'. It's a general-purpose event loop) // (Yes, even though it says 'Server'. It's a general-purpose event loop)
ReflectServer reflectServer; ReflectServer reflectServer;
// This session's job will be to read text from stdin and create Messages // This session's job will be to read text from stdin and create Messages
// to pass to the DumbReflectSession that is connected to the server. // to pass to the DumbReflectSession that is connected to the server.
MyDumbStdinSession myStdinSession; MyDumbStdinSession myStdinSession;
status_t ret; status_t ret;
if (reflectServer.AddNewSession(AbstractReflectSessionRef(&myStdinSession, fa lse), GetInvalidSocket()).IsError(ret)) if (reflectServer.AddNewSession(DummyAbstractReflectSessionRef(myStdinSession ), GetInvalidSocket()).IsError(ret))
{ {
LogTime(MUSCLE_LOG_CRITICALERROR, "Couldn't add MyDumbStdinSession to the client, aborting! [%s]\n", ret()); LogTime(MUSCLE_LOG_CRITICALERROR, "Couldn't add MyDumbStdinSession to the client, aborting! [%s]\n", ret());
return 10; return 10;
} }
// This session will connect out to the server (on localhost) and handle TCP- transmission // This session will connect out to the server (on localhost) and handle TCP- transmission
// of Messages to the server and TCP-reception of Messages from the server. // of Messages to the server and TCP-reception of Messages from the server.
// //
// The SecondsToMicros(1) argument tells the ReflectServer to handle // The SecondsToMicros(1) argument tells the ReflectServer to handle
// a TCP disconnect by automatically reconnecting the session after a 1-secon d delay. // a TCP disconnect by automatically reconnecting the session after a 1-secon d delay.
DumbReflectSession tcpSession; DumbReflectSession tcpSession;
if (reflectServer.AddNewConnectSession(AbstractReflectSessionRef(&tcpSession, false), localhostIP, DUMB_SERVER_TCP_PORT, SecondsToMicros(1)).IsError(ret)) if (reflectServer.AddNewConnectSession(DummyAbstractReflectSessionRef(tcpSess ion), localhostIP, DUMB_SERVER_TCP_PORT, SecondsToMicros(1)).IsError(ret))
{ {
LogTime(MUSCLE_LOG_CRITICALERROR, "Couldn't add DumbReflectSession to the client, aborting! [%s]\n", ret()); LogTime(MUSCLE_LOG_CRITICALERROR, "Couldn't add DumbReflectSession to the client, aborting! [%s]\n", ret());
return 10; return 10;
} }
// Now there's nothing left to do but run the event loop // Now there's nothing left to do but run the event loop
if (reflectServer.ServerProcessLoop().IsOK(ret)) if (reflectServer.ServerProcessLoop().IsOK(ret))
{ {
LogTime(MUSCLE_LOG_INFO, "example_2_dumb_client is exiting normally.\n"); LogTime(MUSCLE_LOG_INFO, "example_2_dumb_client is exiting normally.\n");
} }
 End of changes. 2 change blocks. 
2 lines changed or deleted 2 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)