|Type||Topic||Plugin||Version||macOS||Windows||Linux||Console & Web||iOS|
|class||Network||MBS Network Plugin||17.4||Yes||Yes||Yes||Yes||No|
dim sock as RAWSocketMBS
// create UDP socket
sock = new RAWSocketMBS(RAWSocketMBS.AddressFamilyINet, RAWSocketMBS.SocketTypeDatagram, RAWSocketMBS.ProtocolUDP)
Similar to Xojo's built in Socket class, but more low level and with more options.
Raw sockets for things like PING may need root permissions.
- 3 events
- 12 properties
- property AvailableBytes as Integer
- property Broadcast as Boolean
- property Handle as Integer
- property IPHeaderIncluded as Boolean
- property Lasterror as Integer
- property LocalIP as String
- property LocalPort as Integer
- property ReceiveBufferSize as Integer
- property ReuseAddress as Boolean
- property ReusePort as Boolean
- property SendBufferSize as Integer
- property SocketError as Integer
- 15 methods
- method Bind(DestAddr as Ptr, DestAddrByteSize as Integer) as Boolean
- method Bind(Port as Integer, IP as string = "")
- method Connect(Address as String, Port as Integer, byref ErrorMessage as String) as Boolean
- method Connect(DestAddr as Ptr, DestAddrByteSize as Integer) as Boolean
- method Constructor(AddressFamily as Integer, SocketType as Integer, Protocol as Integer)
- method Destructor
- method Poll
- method Read(ByteSize as Integer, peek as boolean = false) as MemoryBlock
- method ReadAll(peek as boolean = false) as MemoryBlock
- method ReadDatagram(peek as boolean = false) as DatagramMBS
- method Send(Data as Ptr, DataByteSize as Integer, Flags as Integer = 0) as Integer
- method SendMessage(Data as DatagramMBS) as Integer
- method SendMessage(Data as MemoryBlock, IP as String, Port as Integer) as Integer
- method SendMessage(Data as string, IP as String, Port as Integer) as Integer
- method SendTo(Data as Ptr, DataByteSize as Integer, Flags as Integer, DestAddr as Ptr, DestAddrByteSize as Integer) as Integer
- 8 shared methods
- shared method AddressFamilyINet6 as Integer
- shared method CalcChecksum(data as ptr, ByteCount as Integer) as UInt16
- shared method htonl(value as UInt32) as UInt32
- shared method htons(value as UInt16) as UInt16
- shared method inet_addr(IPv4 as String) as UInt32
- shared method inet_ntoa(IPv4 as UInt32) as String
- shared method ntohl(value as UInt32) as UInt32
- shared method ntohs(value as UInt16) as UInt16
- 10 constants
Datagram, e.g. UDP.
Raw socket, requires root permissions.
Stream socket, e.g. TCP/IP.
This class has no sub classes.
Some examples which use this class:
The items on this page are in the following plugins: MBS Network Plugin.
MBS Xojo PDF Plugins