26 #include <UDPSocket.h>
27 #include <TCPCommand_m.h>
35 socket =
new TCPSocket(msg);
36 socket->setCallbackObject(
this);
41 socket->getRemotePort());
43 socket->processMessage(msg);
46 socket->processMessage(msg);
56 TCPSocket* newSocket =
new TCPSocket();
57 newSocket->bind(port);
59 newSocket->setCallbackObject(
this);
68 if (newSocket == NULL) {
81 TCPSocket* newSocket =
new TCPSocket();
83 newSocket->setCallbackObject(
this);
99 if (socket->getState() == TCPSocket::CONNECTED) {
103 transQueue::iterator tx =
queuedTx.find(address);
106 tx->second->push_back(msg);
109 newQueue->push_back(msg);
135 socket->getRemotePort());
144 if (socket == NULL) {
149 socket->getRemotePort());
151 transQueue::iterator tx =
queuedTx.find(remoteAddress);
154 for (uint32 i = 0 ; i < tx->second->size(); i++) {
155 socket->send(tx->second->at(i));
168 socket->getRemotePort());
173 }
else if (socket->getState() == TCPSocket::CLOSED) {
183 socket->getRemotePort());
185 if (code == TCP_I_CONNECTION_REFUSED) {
187 }
else if (code == TCP_I_TIMED_OUT) {
189 }
else if (code == TCP_I_CONNECTION_RESET) {
192 throw new cRuntimeError(
"Invalid error code on socketFailure.");