Jump to content

BlitzMax/Modules/Vertex/BNetEx

From Wikibooks, open books for an open world

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

TNetwork

[edit | edit source]

Functions

[edit | edit source]

GetHostIP

[edit | edit source]

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

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

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

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

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

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)