Пример #1
0
TCPCarrier::TCPCarrier(int32_t fd)
: IOHandler(fd, fd, IOHT_TCP_CARRIER) {
	IOHandlerManager::EnableReadData(this);
	_writeDataEnabled = false;
	_enableWriteDataCalled = false;
	memset(&_farAddress, 0, sizeof (sockaddr_in));
	_farIp = "";
	_farPort = 0;
	memset(&_nearAddress, 0, sizeof (sockaddr_in));
	_nearIp = "";
	_nearPort = 0;
	socklen_t sz = sizeof (int);
	_sendBufferSize = 0;
	if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, (char *) &_sendBufferSize, &sz) != 0) {
		ASSERT("Unable to determine the send buffer size");
	}
	_recvBufferSize = 0;
	if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, (char *) &_recvBufferSize, &sz) != 0) {
		ASSERT("Unable to determine the recv buffer size");
	}
	GetEndpointsInfo();
	_rx = 0;
	_tx = 0;
	_ioAmount = 0;
}
Пример #2
0
void UDPCarrier::GetStats(Variant &info, uint32_t namespaceId) {
	if (!GetEndpointsInfo()) {
		FATAL("Unable to get endpoints info");
		info = "unable to get endpoints info";
		return;
	}
	info["type"] = "IOHT_UDP_CARRIER";
	info["nearIP"] = _nearIp;
	info["nearPort"] = _nearPort;
	info["rx"] = _rx;
}
Пример #3
0
void TCPCarrier::GetStats(Variant &info) {
    if (!GetEndpointsInfo()) {
        FATAL("Unable to get endpoints info");
        info = "unable to get endpoints info";
        return;
    }
    info["type"] = "IOHT_TCP_CARRIER";
    info["farIP"] = _farIp;
    info["farPort"] = _farPort;
    info["nearIP"] = _nearIp;
    info["nearPort"] = _nearPort;
    info["rx"] = _rx;
    info["tx"] = _tx;
}
Пример #4
0
TCPCarrier::TCPCarrier(int32_t fd)
    : IOHandler(fd, fd, IOHT_TCP_CARRIER) {
    IOHandlerManager::EnableReadData(this);
    _writeDataEnabled = false;
    _enableWriteDataCalled = false;
    memset(&_farAddress, 0, sizeof (sockaddr_in));
    _farIp = "";
    _farPort = 0;
    memset(&_nearAddress, 0, sizeof (sockaddr_in));
    _nearIp = "";
    _nearPort = 0;
    GetEndpointsInfo();
    _rx = 0;
    _tx = 0;
}
Пример #5
0
TCPCarrier::TCPCarrier(int32_t fd)
: IOHandler(fd, fd, IOHT_TCP_CARRIER) {
	IOHandlerManager::EnableReadData(this);
	_writeDataEnabled = false;
	_enableWriteDataCalled = false;
	memset(&_farAddress, 0, sizeof (sockaddr_in));
	_farIp = "";
	_farPort = 0;
	memset(&_nearAddress, 0, sizeof (sockaddr_in));
	_nearIp = "";
	_nearPort = 0;
	GetEndpointsInfo();
	_rx = 0;
	_tx = 0;
	_ioAmount = 0;
	_lastRecvError = 0;
	_lastSendError = 0;

	Variant stats;
	GetStats(stats);
}
Пример #6
0
uint16_t TCPCarrier::GetNearEndpointPort() {
	if (_nearPort != 0)
		return _nearPort;
	GetEndpointsInfo();
	return _nearPort;
}
Пример #7
0
string TCPCarrier::GetNearEndpointAddressIp() {
	if (_nearIp != "")
		return _nearIp;
	GetEndpointsInfo();
	return _nearIp;
}
Пример #8
0
sockaddr_in &TCPCarrier::GetNearEndpointAddress() {
	if ((_nearIp == "") || (_nearPort == 0))
		GetEndpointsInfo();
	return _nearAddress;
}