BlitzMax/Modules/Vertex/BNetEx

From Wikibooks, open books for an open world
Jump to: navigation, search

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: [1]

Data Structures[edit]

TNetwork[edit]

Functions[edit]

GetHostIP[edit]

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[edit]

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[edit]

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[edit]

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[edit]

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[edit]

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)