BlitzMax/Modules/Vertex/BNetEx

BNetEx is a network module made by Vertex. It's Open Source, object-oriented and supports both TCP and UDP.

New versions are announced in this thread:

=Data Structures=

GetHostIP
Signature GetHostIP:Int(HostName:String)

Returns the IP address of the given host

Example int_ip:Int = TNetwork.GetHostIP("www.blitzbasic.com") Print TNetwork.StringIP(int_ip)

GetHostIPs
Signature GetHostIPs:Int[](HostName:String)

A host may have several addresses at once which can be found out by this function

Example Local int_ip:Int[] = TNetwork.GetHostIPs("www.google.com") For Local i:Int = EachIn int_ip Print TNetwork.StringIP(i) Next

GetHostName
Signature GetHostName:String(HostIp:Int)

Returns a given host's name

Example Print "The local PC's name is: " + TNetwork.getHostName(TNetwork.IntIP("127.0.0.1"))

StringIP
Signature StringIP:String(IP:Int)

Converts an integer IP into a string IP (also known as "dotted IP")

Example int_ip:Int = TNetwork.GetHostIP("www.blitzbasic.com") Print TNetwork.StringIP(int_ip)

IntIP
Signature IntIP:Int(IP:String)

Converts a string IP into an integer IP

Example Print "The local PC's name is: " + TNetwork.getHostName(TNetwork.IntIP("127.0.0.1"))

TNetStream
TNetStream extends TStream, therefore the usual write/read operations may be used on it. It contains all methods that can be used regardless of the protocol being used (TCP/UDP)