コード例 #1
0
 protected internal virtual void closeSocket()
 {
     if (socket != null)
     {
         try
         {
             socket.close();
         }
         catch (IOException e)
         {
             Console.WriteLine("Error while closing Adhoc socket", e);
         }
         socket = null;
     }
 }
コード例 #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void openSocket() throws java.net.UnknownHostException, java.io.IOException
        public virtual void openSocket()
        {
            if (socket == null)
            {
                socket = createSocket();
                if (Port == 0)
                {
                    int localPort = socket.bind(Port);
                    Port = localPort;
                }
                else
                {
                    int realPort = Modules.sceNetAdhocModule.getRealPortFromServerPort(Port);
                    socket.bind(realPort);
                }
            }
        }