private void serverSynchronous(fastCSharp.code.cSharp.tcpBase.subByteArrayBuffer data, Action <fastCSharp.net.returnValue <tcpServer._o1> > _onReturn_, fastCSharp.net.callback <fastCSharp.net.returnValue <tcpServer._o1> > _callback_, bool _isTask_)
 {
     fastCSharp.net.returnValue <tcpServer._o1> _returnType_ = new fastCSharp.net.returnValue <tcpServer._o1>();
     try
     {
         fastCSharp.net.tcp.commandClient.streamCommandSocket _socket_ = TcpCommandClient.StreamSocket;
         if (_socket_ != null)
         {
             tcpServer._i1 _inputParameter_ = new tcpServer._i1
             {
                 data = data,
             };
             _socket_.Get(_onReturn_, _callback_, _c1, ref _inputParameter_, ref _returnType_.Value, _isTask_);
             return;
         }
         _returnType_.Type = fastCSharp.net.returnValue.type.ClientDisposed;
     }
     catch (Exception _error_)
     {
         _returnType_.Type = fastCSharp.net.returnValue.type.ClientException;
         fastCSharp.log.Error.Add(_error_, null, false);
     }
     if (_callback_ != null)
     {
         _callback_.Callback(ref _returnType_);
     }
     else if (_onReturn_ != null)
     {
         _onReturn_(_returnType_);
     }
 }
            public void serverSynchronous(fastCSharp.code.cSharp.tcpBase.subByteArrayBuffer data, Action <fastCSharp.net.returnValue <fastCSharp.code.cSharp.tcpBase.subByteArrayBuffer> > _onReturn_)
            {
                fastCSharp.net.callback <fastCSharp.net.returnValue <tcpServer._o1> > _onOutput_;
                _onOutput_ = fastCSharp.net.asynchronousMethod.callReturn <fastCSharp.code.cSharp.tcpBase.subByteArrayBuffer, tcpServer._o1> .Get(_onReturn_);

                if (_onReturn_ == null || _onOutput_ != null)
                {
                    serverSynchronous(data, null, _onOutput_, false);
                }
            }
Beispiel #3
0
 /// <summary>
 /// UDP穿透端口服务客户端
 /// </summary>
 /// <param name="client">UDP穿透端口服务客户端</param>
 /// <param name="name">套接字注册名称</param>
 /// <param name="ip">套接字绑定端口信息</param>
 /// <param name="remoteName">远程套接字注册名称</param>
 internal udpSocket(portClient client, byte[] name, ipPort ipPort, byte[] remoteName)
 {
     IpPort = ipPort;
     Socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
     Socket.Bind(new IPEndPoint(new IPAddress(ipPort.Ip), ipPort.Port));
     this.client     = client;
     this.name       = name;
     this.remoteName = new fastCSharp.code.cSharp.tcpBase.subByteArrayBuffer {
         Buffer = subArray <byte> .Unsafe(remoteName, 0, remoteName.Length)
     };
     timeout = date.NowSecond.AddTicks(client.timeoutTicks);
 }
Beispiel #4
0
 /// <summary>
 /// 测试线程
 /// </summary>
 private void testThread()
 {
     try
     {
         byte[] buffer = new byte[packet];
         for (int index = buffer.Length; index != 0; buffer[--index] = (byte)index)
         {
             ;
         }
         fastCSharp.code.cSharp.tcpBase.subByteArrayBuffer parameter = new fastCSharp.code.cSharp.tcpBase.subByteArrayBuffer {
             Buffer = subArray <byte> .Unsafe(buffer, 0, packet)
         };
         int randomPacket         = packet;
         fastCSharp.random random = fastCSharp.random.Default;
         start();
         while (Interlocked.Decrement(ref currentTimes) >= 0 && isStop == 0)
         {
             foreach (testClient client in clients)
             {
                 Interlocked.Increment(ref checkTimes);
                 if (isRandomPacket)
                 {
                     randomPacket = random.Next(packet);
                     parameter.Buffer.UnsafeSetLength(randomPacket);
                 }
                 client.Client.serverSynchronous(parameter, client.OnSend);
                 //client.CommandClient.WaitFree();
                 Interlocked.Add(ref sendSize, randomPacket);
             }
         }
     }
     catch (Exception error)
     {
         isStop = 1;
         context.Post(addMessage, error.ToString());
     }
     finally { checkFinally(); }
 }
 private fastCSharp.code.cSharp.tcpBase.subByteArrayBuffer serverSynchronous(fastCSharp.code.cSharp.tcpBase.subByteArrayBuffer data)
 {
     Interlocked.Add(ref receiveSize, data.Buffer.Count);
     return(data);
 }
 private void serverAsynchronous(fastCSharp.code.cSharp.tcpBase.subByteArrayBuffer data, Func <fastCSharp.net.returnValue <fastCSharp.code.cSharp.tcpBase.subByteArrayBuffer>, bool> onReturn)
 {
     Interlocked.Add(ref receiveSize, data.Buffer.Count);
     onReturn(data);
 }
            public fastCSharp.net.returnValue <fastCSharp.demo.udpPortServer.ipPort> get(fastCSharp.code.cSharp.tcpBase.subByteArrayBuffer name)
            {
                fastCSharp.net.returnValue.type         _returnType_;
                fastCSharp.net.waitCall <tcpServer._o0> _wait_ = fastCSharp.net.waitCall <tcpServer._o0> .Get();

                if (_wait_ == null)
                {
                    _returnType_ = fastCSharp.net.returnValue.type.ClientException;
                }
                else
                {
                    this.get(name, null, _wait_, false);
                    fastCSharp.net.returnValue <tcpServer._o0> _outputParameter_;
                    _wait_.Get(out _outputParameter_);
                    if (_outputParameter_.Type == fastCSharp.net.returnValue.type.Success)
                    {
                        return(_outputParameter_.Value.Return);
                    }
                    _returnType_ = _outputParameter_.Type;
                }
                return(new fastCSharp.net.returnValue <fastCSharp.demo.udpPortServer.ipPort> {
                    Type = _returnType_
                });
            }
Beispiel #8
0
 private ipPort get(fastCSharp.code.cSharp.tcpBase.subByteArrayBuffer name)
 {
     return(UpdServer.Get(name.Buffer));
 }