Ejemplo n.º 1
0
    /**
     *  异步结束接收
     */
    public int EndReceive(IAsyncResult iar)
    {
        DelegateForReceive delReceive = (iar as AsyncResult).AsyncDelegate as DelegateForReceive;
        int result = -1;

        try {
            result = delReceive.EndInvoke(iar);
        }
        catch (Exception ex) {
            Debug.LogError(ex);
        }
        return(result);
    }
Ejemplo n.º 2
0
    /**
     *  异步开始接收
     */
    public IAsyncResult  BeginReceive(byte[] buffer, Int32 size, AsyncCallback callback, System.Object state)
    {
        DelegateForReceive delReceive = new DelegateForReceive(Receive);

        return(delReceive.BeginInvoke(buffer, size, callback, state));
    }