Advertisement
Guest User

Untitled

a guest
Feb 13th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. using System.Threading;
  11. using System.Net;
  12. using System.Net.Sockets;
  13.  
  14. namespace CLIENT_actual_tcp_srvandclient
  15. {
  16. public partial class Form1 : Form
  17. {
  18. public Form1()
  19. {
  20. InitializeComponent();
  21. }
  22. string temp = "";
  23. private void button1_Click(object sender, EventArgs e)
  24. {
  25. //don't ddos me lmao
  26. Thread tr = new Thread(loopyloops);
  27. tr.IsBackground = true;
  28. tr.Start();
  29. button1.Visible = false;
  30. }
  31. private void loopyloops()
  32. {
  33. try
  34. {
  35. TcpClient client = new TcpClient();
  36. client.Connect("92.7.225.234 ", 5000);
  37. while (true)
  38. {
  39. NetworkStream stream = client.GetStream();
  40. byte[] biit = new byte[200];
  41. stream.Read(biit, 0, biit.Length);
  42. string outp = Encoding.ASCII.GetString(biit, 0, biit.Length);
  43. temp = outp;
  44. }
  45.  
  46. }
  47. catch(Exception e)
  48. {
  49.  
  50. }
  51.  
  52.  
  53.  
  54. }
  55.  
  56. private void timer1_Tick(object sender, EventArgs e)
  57. {
  58. if(temp != "")
  59. {
  60. textBox1.Text = temp;
  61. temp = "";
  62. }
  63. else
  64. {
  65.  
  66. }
  67. }
  68. }
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement