Platforms to show: All Mac Windows Linux Cross-Platform
RAWSocketMBS class
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| class | Network | MBS Network Plugin | 17.4 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
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.
For macOS and iOS, your application may need to have the NSLocalNetworkUsageDescription in info.plist for local network access and your sandboxed application may need need the com.apple.security.network.client entitlement.
- 3 events
- event DataAvailable
- event Error
- event SendComplete
- 15 properties
- property AddressFamily as Integer
- 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 Protocol as Integer
- property ReceiveBufferSize as Integer
- property ReuseAddress as Boolean
- property ReusePort as Boolean
- property SendBufferSize as Integer
- property SocketError as Integer
- property SocketType as Integer
- 18 methods
- method Accept(byref RemoteAddress as String, byref RemotePort as Integer, NewSocket as RAWSocketMBS) as RAWSocketMBS
- method Bind(DestAddr as Ptr, DestAddrByteSize as Integer) as Boolean
- method Bind(Port as Integer, IP as string = "")
- method Close
- 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 Listen(BackLog as Integer = 2)
- 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
Address Families
| Constant | Value | Description |
|---|---|---|
| AddressFamilyINet | 2 |
IPv4 |
Protocols
| Constant | Value | Description |
|---|---|---|
| ProtocolICMP | 1 |
ICMP |
| ProtocolIP | 0 |
IPv4 |
| ProtocolIPv6 | 41 |
IPv6 |
| ProtocolRaw | 255 |
Raw protocol |
| ProtocolTCP | 6 |
TCP |
| ProtocolUDP | 17 |
UDP |
Socket Types
| Constant | Value | Description |
|---|---|---|
| SocketTypeDatagram | 2 |
Datagram, e.g. UDP. |
| SocketTypeRaw | 3 |
Raw socket, requires root permissions. |
| SocketTypeStream | 1 |
Stream socket, e.g. TCP/IP. |
This class has no sub classes.
Blog Entries
- MonkeyBread Software Releases the MBS Xojo Plugins in version 18.4
- MBS Xojo Plugins, version 18.4pr10
- MBS Xojo Plugins, version 18.4pr9
- MBS Xojo Plugins, version 18.3pr3
- MonkeyBread Software Releases the MBS Xojo Plugins in version 18.0
- MBS Xojo Plugins, version 18.0pr6
- MonkeyBread Software Releases the MBS Xojo Plugins in version 17.4
- MBS Xojo Plugins, version 17.4pr8
- MBS Xojo Plugins, version 17.4pr5
- Raw Sockets for Xojo
Xojo Developer Magazine
Videos
Release notes
- Version 18.4
- Added Listen, Accept and Close methods to RAWSocketMBS class.
- Added RAWSocketMBS.AddressFamily and UDPSocketMBS.AddressFamily properties.
- Version 18.3
- Added Protocol and SocketType properties to RAWSocketMBS and UDPSocketMBS class.
- Added RAWSocketMBS.Connect method to take IPv4/IPv6/hostname to connect.
- Version 18.0
- Added LocalIP, LocalPort and Poll to RAWSocketMBS and UDPSocketMBS classes.
- Version 17.4
- Added RAWSocketMBS class.
- Added more methods for UDPSockets to RAWSocketMBS class.
Some examples using this class:
- /Network/Raw Socket/Raw Socket for UDP Protocol
- /Network/Raw Socket/RawSocket accept
- /Network/Raw Socket/Unix Socket doing UDP
Some related classes:
The items on this page are in the following plugins: MBS Network Plugin.