コード例 #1
0
ファイル: SocketClient.cs プロジェクト: Yukinii/VOTC-Legacy
 public NetworkClient(NetworkServerSocket server, Socket socket, int bufferLen)
 {
     Alive   = true;
     _server = server;
     _socket = socket;
     _buffer = new byte[bufferLen];
     IP      = (_socket.RemoteEndPoint as IPEndPoint)?.Address.ToString();
 }
コード例 #2
0
 private static void Main()
 {
     try
     {
         API.Initialize(); //Basic security layer, each request has to contain a valid API Key
         ScriptDb.LoadScripts();
         Quotes.Load();
         TrackingListener.Init();
         var serverSock = new NetworkServerSocket {
             ClientBufferSize = 4096, OnConnect = Connecting, OnReceive = Receiving, OnDisconnect = Disconnecting
         };
         serverSock.Prepare(700, 100);
         serverSock.BeginAccept();
         Console.Title    = "BitFlash VOTC Service Host";
         Service          = new ServiceHost(typeof(Logic));//Everything thats used to configure the Server is found in the App.Config
         Service.Faulted += Service_Faulted;
         Service.Open();
         Console.WriteLine("Service running and active on:");
         Console.WriteLine();
         foreach (var baseAddress in Service.BaseAddresses)
         {
             Console.WriteLine("\t" + baseAddress.AbsoluteUri);
         }
         Console.WriteLine();
         Console.WriteLine("Create client code class by executing \n\n\tsvcutil.exe " + Service.BaseAddresses[0] + "?wsdl\n\nin the visual studio developer console!\n");
         Console.WriteLine("Usually Found at\n\n\t'Microsoft Visual Studio 1X.0\\Common7\\Tools\\VsDevCmd.bat'\n\n");
         Console.WriteLine("Press enter to terminate.");
     }
     catch (Exception exception)
     {
         Console.Write(exception);
         Console.ReadLine();
     }
     Console.ReadLine();
     Service.Close();
     Shutdown();
 }