summaryrefslogtreecommitdiff
path: root/cs/src/Ice/Transceiver.cs
blob: 9863ec7c1ba21ebad9b268c92fad43c3a2d01c7c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// **********************************************************************
//
// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************

namespace IceInternal
{
    using System;
    using System.Net.Sockets;

    public interface Transceiver
    {
        //
        // Initialize the transceiver using asynchronous I/O. This method never blocks. Returns true
        // if initialization is complete, or false if an I/O request is pending. In the latter case,
        // the callback must invoke initialize again and repeat this process until it returns true.
        //
        int initialize();

        void close();

        //
        // Write data.
        //
        // Returns true if all the data was written, false otherwise.
        //
        bool write(Buffer buf);

        //
        // Read data.
        //
        // Returns true if all the requested data was read, false otherwise.
        //
        bool read(Buffer buf);

        //
        // Read data asynchronously.
        //
        // The I/O request may complete synchronously, in which case endRead
        // will be invoked in the same thread as beginRead. The return value
        // from beginRead must be passed to endRead, along with the same buffer
        // object. The caller must check the buffer after endRead completes to
        // determine whether all of the requested data has been read.
        //
        // The read request is canceled upon the termination of the thread that
        // calls beginRead, or when the socket is closed. In this case endRead
        // raises ReadAbortedException.
        //
        bool startRead(Buffer buf, AsyncCallback callback, object state);
        void finishRead(Buffer buf);

        //
        // Write data asynchronously.
        //
        // The I/O request may complete synchronously, in which case endWrite
        // will be invoked in the same thread as beginWrite. The request
        // will be canceled upon the termination of the thread that calls beginWrite.
        //
        bool startWrite(Buffer buf, AsyncCallback callback, object state, out bool completed);
        void finishWrite(Buffer buf);

        string type();
        Ice.ConnectionInfo getInfo();
        void checkSendSize(Buffer buf, int messageSizeMax);
    }

}