Simple server and client program in C++
Feb 19, 2012 at 12:43am UTC
Can anyone please tell me the code for simple server and client program in C++ which can pass simple messages between them and how to execute them? I am beginner and I really need this.
Feb 19, 2012 at 1:05am UTC
http://www.lacewing-project.org/ works for *nix.
1 2 3 4 5 6 7 8 9 10
void OnConnect (Lacewing::Server &Server, Lacewing::Server::Client &Client)
{
cout << "Client connected from " << Client.GetAddress().ToString() << endl;
}
//...
Lacewing::EventPump ep;
Lacewing::Server server (ep);
server.onConnect(OnConnect); //register connection handler
server.Host(6121);
ep.StartEventLoop();
1 2 3 4 5 6 7 8 9 10
void OnConnect (Lacewing::Client &Client)
{
cout << "Connected" << endl;
}
//...
Lacewing::EventPump ep;
Lacewing::Client client (ep);
client.onConnect(OnConnect); //register connection handler
client.Conect("localhost" , 6121);
ep.StartEventLoop();
This should help get you started. The documentation is pretty helpful.
Topic archived. No new replies allowed.