1
0
Fork 0
forked from fte/fteqw

Added capability to connect to DarkPlaces servers in QUAKE protocol mode.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@486 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2004-11-20 00:58:38 +00:00
parent 0b5e78fbea
commit 9594a8aaa7

View file

@ -1248,6 +1248,55 @@ void Datagram_SearchForHosts (qboolean xmit)
}
#ifndef SERVERONLY
qsocket_t *Datagram_ConnectToDarkPlacesServer(netadr_t *nadr)
{ //QuakeWorld connection hit upon a DP server.
struct sockaddr_qstorage sendaddr;
qsocket_t *sock;
int newsock;
net_driverlevel = 1;
net_landriverlevel = 0;
//hrm. the server uses out port as well as ip... we connected with the qw port... so we need to swap them over
newsock = cls.socketip;
cls.socketip = dfunc.OpenSocket(0);
if (newsock == -1)
{
cls.socketip = newsock;
Con_Printf("Failed to initialse NQ transports\n");
return NULL;
}
sock = NET_NewQSocket ();
if (sock == NULL)
{
Con_Printf("Failed to initialse NQ transports\n");
dfunc.CloseSocket(newsock);
return NULL;
}
sock->socket = newsock;
sock->landriver = net_landriverlevel;
NetadrToSockadr(nadr, &sendaddr);
if (dfunc.Connect(newsock, &sendaddr) == -1)
{
Con_Printf("Failed to initialse NQ transports\n");
NET_FreeQSocket(sock);
dfunc.CloseSocket(newsock);
return NULL;
}
Q_memcpy(&sock->addr, &sendaddr, sizeof(struct sockaddr_qstorage));
dfunc.GetNameFromAddr (&sendaddr, sock->address);
Con_Printf ("Connection accepted\n");
sock->lastMessageTime = SetNetTime();
return sock;
}
static qsocket_t *_Datagram_Connect (char *host)
{
struct sockaddr_qstorage sendaddr;