Platforms to show: All Mac Windows Linux Cross-Platform
Back to RAWSocketMBS class.
RAWSocketMBS.Accept(byref RemoteAddress as String, byref RemotePort as Integer, NewSocket as RAWSocketMBS) as RAWSocketMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Network | MBS Network Plugin | 18.4 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
Lasterror is set.
RAWSocketMBS.Bind(DestAddr as Ptr, DestAddrByteSize as Integer) as Boolean
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Network | MBS Network Plugin | 17.4 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
Set ReuseAddress to bind to an address which already a socket is bound to.
Lasterror is set.
Returns true on success and false on failure.
Please specify with port and IP in destAddress where to bind against.
Structure of DestAddress is OS and address family dependent.
See also:
RAWSocketMBS.Bind(Port as Integer, IP as string = "")
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Network | MBS Network Plugin | 17.4 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
If IP is not empty, you can bind the socket to only the given network interface with that IPv4.
Set ReuseAddress to bind to an address which already a socket is bound to.
Lasterror is set.
See also:
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Network | MBS Network Plugin | 18.4 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
Same as destructor.
RAWSocketMBS.Connect(Address as String, Port as Integer, byref ErrorMessage as String) as Boolean
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Network | MBS Network Plugin | 18.3 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
Will parse IPv4/IPv6 or query DNS server for IP and connect.
Returns true on success.
See also:
RAWSocketMBS.Connect(DestAddr as Ptr, DestAddrByteSize as Integer) as Boolean
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Network | MBS Network Plugin | 17.4 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
lasterror is set.
Returns true on success and false on failure.
Please specify with port and IP in destAddress where package is sent to.
Structure of DestAddress is OS and address family dependent.
See also:
RAWSocketMBS.Constructor(AddressFamily as Integer, SocketType as Integer, Protocol as Integer)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Network | MBS Network Plugin | 17.4 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
Please pass valid combination of OS supported sockets.
Raises exception if creation is not possible.
Raw socket requires root access.
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Network | MBS Network Plugin | 17.4 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
Closes the socket.
RAWSocketMBS.Listen(BackLog as Integer = 2)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Network | MBS Network Plugin | 18.4 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
Sockets uses the accept function to enable incoming connection attempts on a socket.
RemoteAddress and RemotePort are set to address of remote peer.
If you like to pass in your own subclass object for NewSocket, we can use that socket object. Otherwise, we make a new RAWSocketMBS object.
Lasterror is set.
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Network | MBS Network Plugin | 18.0 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
Calls events if needed.
This is called automatically via timer by the plugin.
RAWSocketMBS.Read(ByteSize as Integer, peek as boolean = false) as MemoryBlock
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Network | MBS Network Plugin | 17.4 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
Pass true for peek if data should not be removed from receiving buffer.
Lasterror is set.
Be aware that you may not get whole packages here, so data may come in several chunks.
For that, please collect the data and look for whether your package is complete or a required end mark arrived.
RAWSocketMBS.ReadAll(peek as boolean = false) as MemoryBlock
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Network | MBS Network Plugin | 17.4 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
Pass true for peek if data should not be removed from receiving buffer.
Lasterror is set.
Be aware that you may not get whole packages here, so data may come in several chunks.
For that, please collect the data and look for whether your package is complete or a required end mark arrived.
RAWSocketMBS.ReadDatagram(peek as boolean = false) as DatagramMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Network | MBS Network Plugin | 17.4 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
If peek is true, the data is not removed from read buffer.
On error returns nil.
Some examples using this method:
RAWSocketMBS.Send(Data as Ptr, DataByteSize as Integer, Flags as Integer = 0) as Integer
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Network | MBS Network Plugin | 17.4 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
Data is sent to address passed with Connect method.
Returns number of bytes sent.
Lasterror is set.
For TCP sockets and similar, which have a stream of data.
RAWSocketMBS.SendMessage(Data as DatagramMBS) as Integer
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Network | MBS Network Plugin | 17.4 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
Please specify with port and address of datagram where package is sent to.
Returns number of bytes sent.
Lasterror is set.
For UDP sockets and similar.
See also:
RAWSocketMBS.SendMessage(Data as MemoryBlock, IP as String, Port as Integer) as Integer
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Network | MBS Network Plugin | 17.4 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
Please specify with port and IP where package is sent to.
Returns number of bytes sent.
Lasterror is set.
For UDP sockets and similar.
See also:
RAWSocketMBS.SendMessage(Data as string, IP as String, Port as Integer) as Integer
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Network | MBS Network Plugin | 17.4 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
Please specify with port and IP where package is sent to.
Returns number of bytes sent.
Lasterror is set.
For UDP sockets and similar.
See also:
RAWSocketMBS.SendTo(Data as Ptr, DataByteSize as Integer, Flags as Integer, DestAddr as Ptr, DestAddrByteSize as Integer) as Integer
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Network | MBS Network Plugin | 17.4 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
Please specify with port and IP in destAddress where package is sent to.
Returns number of bytes sent. Structure of DestAddress is OS and address family dependent.
Lasterror is set.
For UDP sockets and similar.
Some examples using this method:
The items on this page are in the following plugins: MBS Network Plugin.
