1 // **********************************************************************
3 // Copyright (c) 2003-2011 ZeroC, Inc. All rights reserved.
5 // This copy of Ice is licensed to you under the terms described in the
6 // ICE_LICENSE file included in this distribution.
8 // **********************************************************************
11 using System
.Net
.Sockets
;
13 internal class Transceiver
: IceInternal
.Transceiver
15 public int initialize()
17 _configuration
.checkInitializeException();
20 int s
= _transceiver
.initialize();
21 if(s
!= IceInternal
.SocketOperation
.None
)
27 return IceInternal
.SocketOperation
.None
;
35 public bool write(IceInternal
.Buffer buf
)
39 throw new Ice
.SocketException();
42 if(!_configuration
.writeReady())
47 _configuration
.checkWriteException();
48 return _transceiver
.write(buf
);
51 public bool read(IceInternal
.Buffer buf
)
55 throw new Ice
.SocketException();
58 if(!_configuration
.readReady())
63 _configuration
.checkReadException();
64 return _transceiver
.read(buf
);
67 public bool startRead(IceInternal
.Buffer buf
, AsyncCallback callback
, object state
)
69 if(_configuration
.readReady())
71 _configuration
.checkReadException(); // Only raise if we're configured to read now.
73 return _transceiver
.startRead(buf
, callback
, state
);
76 public void finishRead(IceInternal
.Buffer buf
)
78 _configuration
.checkReadException();
79 _transceiver
.finishRead(buf
);
82 public bool startWrite(IceInternal
.Buffer buf
, AsyncCallback callback
, object state
, out bool completed
)
84 _configuration
.checkWriteException();
85 return _transceiver
.startWrite(buf
, callback
, state
, out completed
);
88 public void finishWrite(IceInternal
.Buffer buf
)
90 _configuration
.checkWriteException();
91 _transceiver
.finishWrite(buf
);
96 return "test-" + _transceiver
.type();
99 public Ice
.ConnectionInfo
getInfo()
101 return _transceiver
.getInfo();
104 public override string ToString()
106 return _transceiver
.ToString();
109 public void checkSendSize(IceInternal
.Buffer buf
, int messageSizeMax
)
111 _transceiver
.checkSendSize(buf
, messageSizeMax
);
115 // Only for use by Connector, Acceptor
117 internal Transceiver(IceInternal
.Transceiver transceiver
)
119 _transceiver
= transceiver
;
120 _configuration
= Configuration
.getInstance();
123 private IceInternal
.Transceiver _transceiver
;
124 private Configuration _configuration
;
125 private bool _initialized
= false;