예제 #1
0
 public static void NetDisconect()
 {
     if (!CommuTcp.IsSocketConnected())
     {
         return;
     }
     CommuTcp.TcpSocket.Close();
 }
예제 #2
0
 public static bool NetConect()
 {
     if (!CommuTcp.IsSocketConnected())
     {
         try
         {
             CommuTcp.TcpSocket.Connect(Convert.ToString(FormMain.sCommuAtt.IP0) + (object)'.' + Convert.ToString(FormMain.sCommuAtt.IP1) + (object)'.' + Convert.ToString(FormMain.sCommuAtt.IP2) + (object)'.' + Convert.ToString(FormMain.sCommuAtt.IP3), FormMain.sCommuAtt.Port);
             CommuTcp.TcpSocket.BeginReceive(CommuTcp.EthentRxBuf, 0, CommuTcp.EthentRxBuf.Length, SocketFlags.None, new AsyncCallback(CommuTcp.ReceiveMessage), (object)CommuTcp.TcpSocket);
         }
         catch
         {
             return(false);
         }
     }
     return(CommuTcp.TcpSocket.Connected);
 }