Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Server server = new Server();
- server.start();
- server.bind(54555, 54777);
- server.addListener(new Listener() {
- public void received (Connection connection, Object object) {
- if (object instanceof SomeRequest) {
- SomeRequest request = (SomeRequest)object;
- System.out.println(request.text);
- SomeResponse response = new SomeResponse();
- response.text = "Thanks!";
- connection.sendTCP(response);
- }
- }
- });
- Client client = new Client();
- client.start();
- client.connect(5000, "192.168.0.4", 54555, 54777);
- SomeRequest request = new SomeRequest();
- request.text = "Here is the request!";
- client.sendTCP(request);
Add Comment
Please, Sign In to add comment