예제 #1
0
 /// <summary>
 ///
 /// </summary>
 public void Init()
 {
     this.socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
     this.iep    = new IPEndPoint(IPAddress.Parse(this.ipServer), this.port);
     this.socket.Connect(this.iep);
     if (this.debug == true)
     {
         Console.WriteLine(this.socket.LocalEndPoint.ToString() + " is connected!");
     }
     threadSocket = new ThreadSocket <T>(this.socket);
 }
예제 #2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="obj"></param>
 /// <param name="ipClient"></param>
 public void SendObjectToIP(T obj, string ipClient)
 {
     if (listClient.ContainsKey(ipClient))
     {
         ThreadSocket <T> client = (ThreadSocket <T>)listClient[ipClient];
         client.ObjToSend     = obj;
         listClient[ipClient] = client;
     }
     else
     {
         throw new InvalidOperationException("IP of client not found");
     }
 }