sckt = sckt_in = size = 0;
connected = false;
- #if defined(__BORLANDC__) || defined(_MSC_VER) || defined(__MINGW32__)
+ #if defined(_MSC_VER) || defined(__MINGW32__)
WSADATA wsaData;
int wsaReturnCode;
wsaReturnCode = WSAStartup(MAKEWORD(1,1), &wsaData);
else cout << "Winsock DLL not initialized ..." << endl;
#endif
- if (address.find_first_not_of("0123456789.",0) != address.npos) {
+ if (!is_number(address)) {
if ((host = gethostbyname(address.c_str())) == NULL) {
cout << "Could not get host net address by name..." << endl;
}
sckt = sckt_in = size = 0;
connected = false;
- #if defined(__BORLANDC__) || defined(_MSC_VER) || defined(__MINGW32__)
+ #if defined(_MSC_VER) || defined(__MINGW32__)
WSADATA wsaData;
int wsaReturnCode;
wsaReturnCode = WSAStartup(MAKEWORD(1,1), &wsaData);
cout << "Host name... " << address << ", Port... " << port << "." << endl;
cout << "Host name... (char) " << address.c_str() << "." << endl;
- if (address.find_first_not_of("0123456789.",0) != address.npos) {
+ if (!is_number(address)) {
if ((host = gethostbyname(address.c_str())) == NULL) {
cout << "Could not get host net address by name..." << endl;
}
connected = false;
unsigned long NoBlock = true;
- #if defined(__BORLANDC__) || defined(_MSC_VER) || defined(__MINGW32__)
+ #if defined(_MSC_VER) || defined(__MINGW32__)
WSADATA wsaData;
int wsaReturnCode;
wsaReturnCode = WSAStartup(MAKEWORD(1,1), &wsaData);
if (bind(sckt, (struct sockaddr*)&scktName, len) == 0) { // successful
cout << "Successfully bound to socket for input on port " << port << endl;
if (listen(sckt, 5) >= 0) { // successful listen()
- #if defined(__BORLANDC__) || defined(_MSC_VER) || defined(__MINGW32__)
+ #if defined(_MSC_VER) || defined(__MINGW32__)
ioctlsocket(sckt, FIONBIO, &NoBlock);
sckt_in = accept(sckt, (struct sockaddr*)&scktName, &len);
#else
FGfdmSocket::~FGfdmSocket()
{
- #ifndef macintosh
if (sckt) shutdown(sckt,2);
if (sckt_in) shutdown(sckt_in,2);
- #endif
-
- #ifdef __BORLANDC__
- WSACleanup();
- #endif
Debug(1);
}
// class attribute and pass as a reference?
if (sckt_in <= 0) {
- #if defined(__BORLANDC__) || defined(_MSC_VER) || defined(__MINGW32__)
+ #if defined(_MSC_VER) || defined(__MINGW32__)
sckt_in = accept(sckt, (struct sockaddr*)&scktName, &len);
#else
sckt_in = accept(sckt, (struct sockaddr*)&scktName, (socklen_t*)&len);
#endif
if (sckt_in > 0) {
- #if defined(__BORLANDC__) || defined(_MSC_VER) || defined(__MINGW32__)
+ #if defined(_MSC_VER) || defined(__MINGW32__)
ioctlsocket(sckt_in, FIONBIO,&NoBlock);
#else
ioctl(sckt_in, FIONBIO, &NoBlock);