1999-12-25 05:22:39 +00:00
|
|
|
/*
|
2000-03-24 12:43:07 +00:00
|
|
|
net_udp.c
|
1999-12-25 05:22:39 +00:00
|
|
|
|
2000-03-24 12:43:07 +00:00
|
|
|
(description)
|
1999-12-25 05:22:39 +00:00
|
|
|
|
2000-03-24 12:43:07 +00:00
|
|
|
Copyright (C) 1999,2000 Nelson Rush.
|
|
|
|
Copyright (C) 2000 Marcus Sundberg [mackan@stacken.kth.se]
|
|
|
|
Copyright (C) 1996-1997 Id Software, Inc.
|
|
|
|
Copyright (C) 1999,2000 contributors of the QuakeForge project
|
|
|
|
Please see the file "AUTHORS" for a list of contributors
|
1999-12-25 05:22:39 +00:00
|
|
|
|
2000-03-24 12:43:07 +00:00
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
1999-12-25 05:22:39 +00:00
|
|
|
|
2000-03-24 12:43:07 +00:00
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
1999-12-25 05:22:39 +00:00
|
|
|
|
2000-03-24 12:43:07 +00:00
|
|
|
See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to:
|
|
|
|
|
|
|
|
Free Software Foundation, Inc.
|
|
|
|
59 Temple Place - Suite 330
|
|
|
|
Boston, MA 02111-1307, USA
|
|
|
|
|
|
|
|
$Id$
|
1999-12-25 05:22:39 +00:00
|
|
|
*/
|
|
|
|
|
2000-03-24 12:43:07 +00:00
|
|
|
#include <qtypes.h>
|
|
|
|
#include <quakedef.h>
|
|
|
|
#include <net.h>
|
|
|
|
#include <sys.h>
|
|
|
|
#include <console.h>
|
1999-12-25 05:22:39 +00:00
|
|
|
|
2000-01-04 22:56:56 +00:00
|
|
|
#include <stdio.h>
|
1999-12-25 05:22:39 +00:00
|
|
|
#include <errno.h>
|
|
|
|
|
2000-01-04 22:56:56 +00:00
|
|
|
/* Sun's model_t in sys/model.h conflicts w/ Quake's model_t */
|
|
|
|
#define model_t quakeforgemodel_t
|
|
|
|
|
2000-01-19 11:01:04 +00:00
|
|
|
#ifdef HAVE_UNISTD_H
|
1999-12-25 05:22:39 +00:00
|
|
|
#include <unistd.h>
|
2000-01-19 11:01:04 +00:00
|
|
|
#endif
|
2000-02-20 21:19:50 +00:00
|
|
|
|
2000-01-04 22:56:56 +00:00
|
|
|
#include <sys/types.h>
|
|
|
|
|
|
|
|
#ifdef HAVE_SYS_IOCTL_H
|
|
|
|
# include <sys/ioctl.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_SYS_SOCKET_H
|
|
|
|
# include <sys/socket.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_NETINET_IN_H
|
|
|
|
# include <netinet/in.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_NETDB_H
|
|
|
|
# include <netdb.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_ARPA_INET_H
|
|
|
|
# include <arpa/inet.h>
|
|
|
|
#endif
|
2000-01-05 16:55:01 +00:00
|
|
|
#ifdef HAVE_SYS_FILIO_H
|
|
|
|
# include <sys/filio.h>
|
|
|
|
#endif
|
2000-01-04 22:56:56 +00:00
|
|
|
|
1999-12-29 13:58:47 +00:00
|
|
|
#undef model_t
|
2000-01-04 22:56:56 +00:00
|
|
|
|
|
|
|
#ifdef _WIN32
|
2000-03-24 12:43:07 +00:00
|
|
|
# include <winquake.h>
|
2000-01-04 22:56:56 +00:00
|
|
|
# undef EWOULDBLOCK
|
|
|
|
# define EWOULDBLOCK WSAEWOULDBLOCK
|
1999-12-25 05:22:39 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef NeXT
|
|
|
|
#include <libc.h>
|
|
|
|
#endif
|
|
|
|
|
2000-01-04 22:56:56 +00:00
|
|
|
#ifndef MAXHOSTNAMELEN
|
|
|
|
#define MAXHOSTNAMELEN 512
|
|
|
|
#endif
|
|
|
|
|
1999-12-25 05:22:39 +00:00
|
|
|
netadr_t net_local_adr;
|
|
|
|
|
|
|
|
netadr_t net_from;
|
|
|
|
sizebuf_t net_message;
|
2000-01-04 22:56:56 +00:00
|
|
|
int net_socket;
|
1999-12-25 05:22:39 +00:00
|
|
|
|
2000-01-04 22:56:56 +00:00
|
|
|
#define MAX_UDP_PACKET (MAX_MSGLEN*2)
|
1999-12-25 05:22:39 +00:00
|
|
|
byte net_message_buffer[MAX_UDP_PACKET];
|
|
|
|
|
2000-01-04 22:56:56 +00:00
|
|
|
#ifdef _WIN32
|
|
|
|
WSADATA winsockdata;
|
|
|
|
#endif
|
1999-12-25 05:22:39 +00:00
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
|
2000-08-20 13:33:48 +00:00
|
|
|
void
|
|
|
|
NetadrToSockadr ( netadr_t *a, struct sockaddr_in *s )
|
1999-12-25 05:22:39 +00:00
|
|
|
{
|
|
|
|
memset (s, 0, sizeof(*s));
|
|
|
|
s->sin_family = AF_INET;
|
|
|
|
|
2000-01-07 21:31:20 +00:00
|
|
|
*(int *)&s->sin_addr = *(int *)a->ip;
|
1999-12-25 05:22:39 +00:00
|
|
|
s->sin_port = a->port;
|
|
|
|
}
|
|
|
|
|
2000-08-20 13:33:48 +00:00
|
|
|
void
|
|
|
|
SockadrToNetadr ( struct sockaddr_in *s, netadr_t *a )
|
1999-12-25 05:22:39 +00:00
|
|
|
{
|
2000-01-07 21:31:20 +00:00
|
|
|
*(int *)a->ip = *(int *)&s->sin_addr;
|
1999-12-25 05:22:39 +00:00
|
|
|
a->port = s->sin_port;
|
|
|
|
}
|
|
|
|
|
2000-08-20 13:33:48 +00:00
|
|
|
qboolean
|
|
|
|
NET_AdrIsLoopback ( netadr_t a )
|
2000-06-14 19:55:05 +00:00
|
|
|
{
|
2000-08-20 13:33:48 +00:00
|
|
|
return *(unsigned *)a.ip == htonl(INADDR_LOOPBACK);
|
2000-06-14 19:55:05 +00:00
|
|
|
}
|
|
|
|
|
2000-08-20 13:33:48 +00:00
|
|
|
qboolean
|
|
|
|
NET_CompareBaseAdr ( netadr_t a, netadr_t b )
|
1999-12-25 05:22:39 +00:00
|
|
|
{
|
|
|
|
if (a.ip[0] == b.ip[0] && a.ip[1] == b.ip[1] && a.ip[2] == b.ip[2] && a.ip[3] == b.ip[3])
|
|
|
|
return true;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-08-20 13:33:48 +00:00
|
|
|
qboolean
|
|
|
|
NET_CompareAdr ( netadr_t a, netadr_t b )
|
1999-12-25 05:22:39 +00:00
|
|
|
{
|
|
|
|
if (a.ip[0] == b.ip[0] && a.ip[1] == b.ip[1] && a.ip[2] == b.ip[2] && a.ip[3] == b.ip[3] && a.port == b.port)
|
|
|
|
return true;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2000-08-20 13:33:48 +00:00
|
|
|
char *
|
|
|
|
NET_AdrToString ( netadr_t a )
|
1999-12-25 05:22:39 +00:00
|
|
|
{
|
|
|
|
static char s[64];
|
2000-03-19 15:59:51 +00:00
|
|
|
|
2000-01-05 00:05:48 +00:00
|
|
|
snprintf(s, sizeof(s), "%i.%i.%i.%i:%i", a.ip[0], a.ip[1], a.ip[2], a.ip[3], ntohs(a.port));
|
1999-12-25 05:22:39 +00:00
|
|
|
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
2000-08-20 13:33:48 +00:00
|
|
|
char *
|
|
|
|
NET_BaseAdrToString ( netadr_t a )
|
1999-12-25 05:22:39 +00:00
|
|
|
{
|
|
|
|
static char s[64];
|
2000-03-19 15:59:51 +00:00
|
|
|
|
2000-01-05 00:05:48 +00:00
|
|
|
snprintf(s, sizeof(s), "%i.%i.%i.%i", a.ip[0], a.ip[1], a.ip[2], a.ip[3]);
|
1999-12-25 05:22:39 +00:00
|
|
|
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
=============
|
|
|
|
NET_StringToAdr
|
|
|
|
|
|
|
|
idnewt
|
|
|
|
idnewt:28000
|
|
|
|
192.246.40.70
|
|
|
|
192.246.40.70:28000
|
|
|
|
=============
|
|
|
|
*/
|
2000-08-20 13:33:48 +00:00
|
|
|
qboolean
|
|
|
|
NET_StringToAdr ( char *s, netadr_t *a )
|
1999-12-25 05:22:39 +00:00
|
|
|
{
|
|
|
|
struct hostent *h;
|
|
|
|
struct sockaddr_in sadr;
|
|
|
|
char *colon;
|
|
|
|
char copy[128];
|
2000-03-19 15:59:51 +00:00
|
|
|
|
1999-12-25 05:22:39 +00:00
|
|
|
memset (&sadr, 0, sizeof(sadr));
|
|
|
|
sadr.sin_family = AF_INET;
|
2000-03-19 15:59:51 +00:00
|
|
|
|
1999-12-25 05:22:39 +00:00
|
|
|
sadr.sin_port = 0;
|
|
|
|
|
|
|
|
strcpy (copy, s);
|
|
|
|
// strip off a trailing :port if present
|
|
|
|
for (colon = copy ; *colon ; colon++)
|
|
|
|
if (*colon == ':')
|
|
|
|
{
|
|
|
|
*colon = 0;
|
2000-01-04 22:56:56 +00:00
|
|
|
sadr.sin_port = htons((unsigned short)atoi(colon+1));
|
1999-12-25 05:22:39 +00:00
|
|
|
}
|
2000-03-19 15:59:51 +00:00
|
|
|
|
1999-12-25 05:22:39 +00:00
|
|
|
if (copy[0] >= '0' && copy[0] <= '9')
|
|
|
|
{
|
|
|
|
*(int *)&sadr.sin_addr = inet_addr(copy);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (! (h = gethostbyname(copy)) )
|
|
|
|
return 0;
|
|
|
|
*(int *)&sadr.sin_addr = *(int *)h->h_addr_list[0];
|
|
|
|
}
|
2000-03-19 15:59:51 +00:00
|
|
|
|
1999-12-25 05:22:39 +00:00
|
|
|
SockadrToNetadr (&sadr, a);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2000-03-19 15:59:51 +00:00
|
|
|
// Returns true if we can't bind the address locally--in other words,
|
1999-12-25 05:22:39 +00:00
|
|
|
// the IP is NOT one of our interfaces.
|
2000-08-20 13:33:48 +00:00
|
|
|
qboolean
|
|
|
|
NET_IsClientLegal ( netadr_t *adr )
|
1999-12-25 05:22:39 +00:00
|
|
|
{
|
1999-12-25 19:37:15 +00:00
|
|
|
#if 0
|
1999-12-25 05:22:39 +00:00
|
|
|
struct sockaddr_in sadr;
|
|
|
|
int newsocket;
|
|
|
|
|
|
|
|
if (adr->ip[0] == 127)
|
2000-08-20 13:33:48 +00:00
|
|
|
return false; // no local connections period
|
1999-12-25 05:22:39 +00:00
|
|
|
|
|
|
|
NetadrToSockadr (adr, &sadr);
|
|
|
|
|
|
|
|
if ((newsocket = socket (PF_INET, SOCK_DGRAM, IPPROTO_UDP)) == -1)
|
2000-01-07 17:35:02 +00:00
|
|
|
Sys_Error ("NET_IsClientLegal: socket: %s", strerror(errno));
|
1999-12-25 05:22:39 +00:00
|
|
|
|
|
|
|
sadr.sin_port = 0;
|
|
|
|
|
2000-03-19 15:59:51 +00:00
|
|
|
if( bind (newsocket, (void *)&sadr, sizeof(sadr)) == -1)
|
1999-12-25 05:22:39 +00:00
|
|
|
{
|
|
|
|
// It is not a local address
|
|
|
|
close(newsocket);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
close(newsocket);
|
|
|
|
return false;
|
|
|
|
#else
|
|
|
|
return true;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
|
2000-08-20 13:33:48 +00:00
|
|
|
qboolean
|
|
|
|
NET_GetPacket ( void )
|
1999-12-25 05:22:39 +00:00
|
|
|
{
|
2000-08-20 13:33:48 +00:00
|
|
|
int ret;
|
|
|
|
struct sockaddr_in from;
|
|
|
|
socklen_t fromlen;
|
1999-12-25 05:22:39 +00:00
|
|
|
|
|
|
|
fromlen = sizeof(from);
|
2000-01-04 22:56:56 +00:00
|
|
|
ret = recvfrom(net_socket, (void*)net_message_buffer, sizeof(net_message_buffer), 0, (struct sockaddr *)&from, &fromlen);
|
|
|
|
SockadrToNetadr (&from, &net_from);
|
|
|
|
|
1999-12-25 05:22:39 +00:00
|
|
|
if (ret == -1) {
|
2000-01-04 22:56:56 +00:00
|
|
|
#ifdef _WIN32
|
|
|
|
int err = WSAGetLastError();
|
|
|
|
|
|
|
|
if (err == WSAEMSGSIZE) {
|
|
|
|
Con_Printf ("Warning: Oversize packet from %s\n",
|
|
|
|
NET_AdrToString (net_from));
|
1999-12-25 05:22:39 +00:00
|
|
|
return false;
|
2000-01-04 22:56:56 +00:00
|
|
|
}
|
|
|
|
#else /* _WIN32 */
|
|
|
|
int err = errno;
|
|
|
|
|
|
|
|
if (err == ECONNREFUSED)
|
1999-12-25 05:22:39 +00:00
|
|
|
return false;
|
2000-01-04 22:56:56 +00:00
|
|
|
#endif /* _WIN32 */
|
|
|
|
if (err == EWOULDBLOCK)
|
|
|
|
return false;
|
|
|
|
Sys_Printf ("NET_GetPacket: %s\n", strerror(err));
|
1999-12-25 05:22:39 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
net_message.cursize = ret;
|
2000-01-04 22:56:56 +00:00
|
|
|
if (ret == sizeof(net_message_buffer)) {
|
|
|
|
Con_Printf ("Oversize packet from %s\n",
|
2000-08-20 13:33:48 +00:00
|
|
|
NET_AdrToString (net_from));
|
2000-01-04 22:56:56 +00:00
|
|
|
return false;
|
|
|
|
}
|
1999-12-25 05:22:39 +00:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
|
2000-08-20 13:33:48 +00:00
|
|
|
void
|
|
|
|
NET_SendPacket ( int length, void *data, netadr_t to )
|
1999-12-25 05:22:39 +00:00
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
struct sockaddr_in addr;
|
|
|
|
|
|
|
|
NetadrToSockadr (&to, &addr);
|
|
|
|
|
|
|
|
ret = sendto (net_socket, data, length, 0, (struct sockaddr *)&addr, sizeof(addr) );
|
|
|
|
if (ret == -1) {
|
2000-01-04 22:56:56 +00:00
|
|
|
#ifdef _WIN32
|
|
|
|
int err = WSAGetLastError();
|
|
|
|
|
|
|
|
#ifndef SERVERONLY
|
|
|
|
if (err == WSAEADDRNOTAVAIL)
|
|
|
|
Con_DPrintf("NET_SendPacket Warning: %i\n", err);
|
|
|
|
#endif
|
|
|
|
#else /* _WIN32 */
|
|
|
|
int err = errno;
|
|
|
|
|
|
|
|
if (err == ECONNREFUSED)
|
1999-12-25 05:22:39 +00:00
|
|
|
return;
|
2000-01-04 22:56:56 +00:00
|
|
|
#endif /* _WIN32 */
|
|
|
|
if (err == EWOULDBLOCK)
|
1999-12-25 05:22:39 +00:00
|
|
|
return;
|
2000-01-04 22:56:56 +00:00
|
|
|
|
|
|
|
Sys_Printf ("NET_SendPacket: %s\n", strerror(err));
|
1999-12-25 05:22:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
|
2000-08-20 13:33:48 +00:00
|
|
|
int
|
|
|
|
UDP_OpenSocket ( int port )
|
1999-12-25 05:22:39 +00:00
|
|
|
{
|
|
|
|
int newsocket;
|
|
|
|
struct sockaddr_in address;
|
2000-01-04 22:56:56 +00:00
|
|
|
#ifdef _WIN32
|
|
|
|
#define ioctl ioctlsocket
|
|
|
|
unsigned long _true = true;
|
|
|
|
#else
|
|
|
|
int _true = 1;
|
|
|
|
#endif
|
1999-12-25 05:22:39 +00:00
|
|
|
int i;
|
|
|
|
|
|
|
|
if ((newsocket = socket (PF_INET, SOCK_DGRAM, IPPROTO_UDP)) == -1)
|
2000-01-07 17:35:02 +00:00
|
|
|
Sys_Error ("UDP_OpenSocket: socket: %s", strerror(errno));
|
2000-01-04 22:56:56 +00:00
|
|
|
if (ioctl (newsocket, FIONBIO, &_true) == -1)
|
2000-01-07 17:35:02 +00:00
|
|
|
Sys_Error ("UDP_OpenSocket: ioctl FIONBIO: %s", strerror(errno));
|
1999-12-25 05:22:39 +00:00
|
|
|
address.sin_family = AF_INET;
|
|
|
|
//ZOID -- check for interface binding option
|
|
|
|
if ((i = COM_CheckParm("-ip")) != 0 && i < com_argc) {
|
|
|
|
address.sin_addr.s_addr = inet_addr(com_argv[i+1]);
|
|
|
|
Con_Printf("Binding to IP Interface Address of %s\n",
|
|
|
|
inet_ntoa(address.sin_addr));
|
|
|
|
} else
|
|
|
|
address.sin_addr.s_addr = INADDR_ANY;
|
|
|
|
if (port == PORT_ANY)
|
|
|
|
address.sin_port = 0;
|
|
|
|
else
|
2000-01-04 22:56:56 +00:00
|
|
|
address.sin_port = htons((unsigned short)port);
|
1999-12-25 05:22:39 +00:00
|
|
|
if( bind (newsocket, (void *)&address, sizeof(address)) == -1)
|
|
|
|
Sys_Error ("UDP_OpenSocket: bind: %s", strerror(errno));
|
|
|
|
|
|
|
|
return newsocket;
|
|
|
|
}
|
|
|
|
|
2000-08-20 13:33:48 +00:00
|
|
|
void
|
|
|
|
NET_GetLocalAddress ( void )
|
1999-12-25 05:22:39 +00:00
|
|
|
{
|
2000-08-20 13:33:48 +00:00
|
|
|
char buff[MAXHOSTNAMELEN];
|
1999-12-25 05:22:39 +00:00
|
|
|
struct sockaddr_in address;
|
2000-08-20 13:33:48 +00:00
|
|
|
socklen_t namelen;
|
1999-12-25 05:22:39 +00:00
|
|
|
|
2000-01-07 17:35:02 +00:00
|
|
|
if (gethostname(buff, MAXHOSTNAMELEN) == -1)
|
2000-08-20 13:33:48 +00:00
|
|
|
Sys_Error ("Net_GetLocalAddress: gethostname: %s", strerror(errno));
|
1999-12-25 05:22:39 +00:00
|
|
|
buff[MAXHOSTNAMELEN-1] = 0;
|
|
|
|
|
|
|
|
NET_StringToAdr (buff, &net_local_adr);
|
|
|
|
|
|
|
|
namelen = sizeof(address);
|
|
|
|
if (getsockname (net_socket, (struct sockaddr *)&address, &namelen) == -1)
|
2000-01-07 17:35:02 +00:00
|
|
|
Sys_Error ("NET_GetLocalAddress: getsockname: %s", strerror(errno));
|
1999-12-25 05:22:39 +00:00
|
|
|
net_local_adr.port = address.sin_port;
|
|
|
|
|
|
|
|
Con_Printf("IP address %s\n", NET_AdrToString (net_local_adr) );
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
====================
|
|
|
|
NET_Init
|
|
|
|
====================
|
|
|
|
*/
|
2000-08-20 13:33:48 +00:00
|
|
|
void
|
|
|
|
NET_Init ( int port )
|
1999-12-25 05:22:39 +00:00
|
|
|
{
|
2000-01-04 22:56:56 +00:00
|
|
|
#ifdef _WIN32
|
2000-03-19 15:59:51 +00:00
|
|
|
WORD wVersionRequested;
|
2000-01-04 22:56:56 +00:00
|
|
|
int r;
|
|
|
|
|
2000-03-19 15:59:51 +00:00
|
|
|
wVersionRequested = MAKEWORD(1, 1);
|
2000-01-04 22:56:56 +00:00
|
|
|
|
|
|
|
r = WSAStartup(MAKEWORD(1, 1), &winsockdata);
|
|
|
|
if (r)
|
|
|
|
Sys_Error ("Winsock initialization failed.");
|
|
|
|
#endif /* _WIN32 */
|
|
|
|
|
1999-12-25 05:22:39 +00:00
|
|
|
//
|
|
|
|
// open the single socket to be used for all communications
|
|
|
|
//
|
|
|
|
net_socket = UDP_OpenSocket (port);
|
|
|
|
|
|
|
|
//
|
|
|
|
// init the message buffer
|
|
|
|
//
|
|
|
|
net_message.maxsize = sizeof(net_message_buffer);
|
|
|
|
net_message.data = net_message_buffer;
|
|
|
|
|
|
|
|
//
|
|
|
|
// determine my name & address
|
|
|
|
//
|
|
|
|
NET_GetLocalAddress ();
|
|
|
|
|
|
|
|
Con_Printf("UDP Initialized\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
====================
|
|
|
|
NET_Shutdown
|
|
|
|
====================
|
|
|
|
*/
|
2000-08-20 13:33:48 +00:00
|
|
|
void
|
|
|
|
NET_Shutdown ( void )
|
1999-12-25 05:22:39 +00:00
|
|
|
{
|
2000-01-04 22:56:56 +00:00
|
|
|
#ifdef _WIN32
|
|
|
|
closesocket(net_socket);
|
|
|
|
WSACleanup();
|
|
|
|
#else
|
|
|
|
close(net_socket);
|
|
|
|
#endif
|
1999-12-25 05:22:39 +00:00
|
|
|
}
|