This page describes the used networking protocol of BZFlag.
The network protocol is cross platform, however implementation of sockes is different on the platforms. *nix, Linux and Mac OS X use BSD sockets, Windows® uses WinSock. WinSock is not 100% compatible to the standard therefore if you use a low level language you need different code for Windows® to do the same like on other platforms.
Connecting to a server
The bzfquery.php script is a nice example of how to connect to a server.
At the beginning you need to open a socket using the TCP/IP protocol. Beginning with protocol 0048 you need to send "BZFLAG\r\n\r\n" in order to get any reply. At that time you unfortunately don't know the protocol, so send it by default or your script will probably freeze. Protocols sooner than 0048 will kick your client because they do not expect that packet but that will be discussed later.
Then you will get 9 bytes from the socket: First the string "BZFS" and then a 4 digit protocol number. If the protocol is newer or equal to 0048 your established connection is fine. If it is older than 0048 your client has been kicked, in this case you need to reconnect again without sending "BZFLAG\r\n\r\n".