Пример #1
0
        private void OnAcceptCompletion(PPError result, PPResource socket)
        {
            if (result != PPError.Ok)
            {
                instance.PostMessage($"server: Accept failed: {result}");
                return;
            }

            var addr = PPBTCPSocket.GetLocalAddress(socket);

            instance.PostMessage($"server: New connection from: {((Var)PPBNetAddress.DescribeAsString(addr, PPBool.True)).ToString()}");
            incomingSocket = new PPResource(socket);

            TryRead();
        }
Пример #2
0
        private void OnListenCompletion(PPError result)
        {
            var status = string.Empty;

            if (result != PPError.Ok)
            {
                instance.PostMessage($"server: Listen failed with: {result}");
                return;
            }

            var addr = PPBTCPSocket.GetLocalAddress(listeningSocket);

            instance.PostMessage($"server: Listening on: {((Var)PPBNetAddress.DescribeAsString(addr, PPBool.True)).AsString()}");

            TryAccept();
        }