Advertisement
Guest User

Untitled

a guest
Dec 9th, 2016
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. static string user_to = "test8";
  2.  
  3. static void GetMsgLoop()
  4. {
  5. while(true)
  6. {
  7. string str = MessengerInterop.GetMessage();
  8. Console.WriteLine("Message received: " + str);
  9. }
  10. }
  11.  
  12. static void SendMsgLoop()
  13. {
  14. string msg;
  15. while (true)
  16. {
  17. msg = Console.ReadLine();
  18. byte[] username_bytes = Encoding.UTF8.GetBytes(user_to);
  19. byte[] msg_bytes = Encoding.UTF8.GetBytes(msg);
  20. MessengerInterop.SendMessage(username_bytes, msg_bytes);
  21. }
  22. }
  23.  
  24. Thread GetMsgThread = new Thread(GetMsgLoop);
  25. Thread SendMsgThread = new Thread(SendMsgLoop);
  26.  
  27.  
  28. GetMsgThread.Start();
  29. SendMsgThread.Start();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement