Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import net;
- import std.socket;
- import std.stdio;
- import std.conv;
- import core.thread;
- import messages;
- int main()
- {
- auto con = Connection.connect(new InternetAddress("127.0.0.1", 9861));
- while(true)
- {
- {//SEND
- MsgCharacterUpdate msg;
- msg.position = [12,13,14];
- msg.orientation = [55,66,77,88];
- msg.scale = [1,2,3];
- writeln("SEND:\n", msg.toString());
- con.send(1234);
- con.send(msg);
- writeln();
- }
- {//RECEIVE
- writeln("RECV:");
- con.receive(
- (MsgCharacterUpdate msg){ writeln("MsgCharUpdate: ", msg); },
- (int i){writeln("INT: ", i);}
- );
- }
- Thread.sleep( dur!("msecs")( 1000 ) );
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment