Exemple #1
0
        private static MessageStructure DoRequest(IPEndPoint remoteEndPoint, string param, int bufferSize, int actionId, string pid)
        {
            byte[]    data      = Encoding.UTF8.GetBytes("?d=" + param);
            MyConnect myConnect = null;

            if (!_clientSockets.ContainsKey(pid))
            {
                myConnect           = new MyConnect();
                _clientSockets[pid] = myConnect;
            }
            else
            {
                myConnect = _clientSockets[pid];
            }

            if (myConnect.Client == null || myConnect.Check(remoteEndPoint))
            {
                myConnect.EndPoint        = remoteEndPoint;
                myConnect.Client          = new ClientSocket(new ClientSocketSettings(bufferSize, remoteEndPoint));
                myConnect.Client.UserData = myConnect;
                myConnect.Bind();
            }
            if (!myConnect.Client.Connected)
            {
                myConnect.Client.Connect();
            }
            if (myConnect.PutAction(actionId))
            {
                myConnect.Client.PostSend(data, 0, data.Length);
                return(myConnect.GetResult());
            }
            return(null);
        }
Exemple #2
0
        private static MessageStructure DoRequest(IPEndPoint remoteEndPoint, string param, int bufferSize, int actionId, string pid)
        {
            byte[] data = Encoding.UTF8.GetBytes("?d=" + param);
            MyConnect myConnect = null;
            if (!_clientSockets.ContainsKey(pid))
            {
                myConnect = new MyConnect();
                _clientSockets[pid] = myConnect;
            }
            else
            {
                myConnect = _clientSockets[pid];
            }

            if (myConnect.Client == null || myConnect.Check(remoteEndPoint))
            {
                myConnect.EndPoint = remoteEndPoint;
                myConnect.Client = new ClientSocket(new ClientSocketSettings(bufferSize, remoteEndPoint));
                myConnect.Client.UserData = myConnect;
                myConnect.Bind();
            }
            if (!myConnect.Client.Connected)
            {
                myConnect.Client.Connect();
            }
            if (myConnect.PutAction(actionId))
            {
                myConnect.Client.PostSend(data, 0, data.Length);
                return myConnect.GetResult();
            }
            return null;
        }