UdpSocket (gb.net)
This class allows Gambas programs to communicate using UDP sockets.
It can be used like a server or client, as each data fragment sent or received is identified with its host IP and port.
This class inherits from
Stream class, so you can use standard stream methods to read, write and close the socket.
Свойства
Broadcast
|
Return or set if the UpdSocket will broadcast its packets.
|
Host
|
Return or set the IP address the UDP socket will be bound to.
|
Multicast
|
This property returns a virtual object that allows to use the UDP socket for doing multicast.
|
Path
|
Return or set the udp socket path for local sockets.
|
Port
|
Return or set the port number used for binding the UDP socket.
|
SourceHost
|
Return the source IP address if the message comes from the internet.
|
SourcePath
|
Return the source path if the message comes from a local socket.
|
SourcePort
|
Return the source port if the message comes from the internet.
|
Status
|
Returns the status of the socket, as a constant of the Net class.
|
StatusText
|
Return the status of the socket as a string.
|
TargetHost
|
Define the target IP address if the message goes to the internet.
|
TargetPath
|
Define the target path if the message goes to a local socket.
|
TargetPort
|
Define the target port if the message goes to the internet.
|
Timeout
|
Return or set the timeout of the socket, in milliseconds.
|
Inherited properties
Blocking
|
Returns or sets if the stream is blocking.
|
ByteOrder
|
Returns or sets the byte order used to read or write binary data to the stream.
|
EndOfFile
|
This property signals whether the last use of LINE INPUT reached the end of file,
instead of reading a full line with an end-of-line character.
|
EndOfLine
|
Return or set the newline separator used by this stream.
|
Eof
|
Return if a stream reached its end.
|
Handle
|
Returns the system file descriptor associated with this Stream.
|
IsTerm
|
Return if a stream is associated with a terminal.
|
Lines
|
Returns a virtual object that allows you to enumerate a stream line by line.
|
NoShare
|
|
NullTerminatedString
|
Return or set if strings are null-terminated when they are serialized.
|
Tag
|
Returns or sets the tag associated with the stream.
|
Term
|
Return a virtual object that allows to manage the terminal associated with the stream.
|
Методы
Bind
|
Bind a socket so the object can start sending and receiving data.
|
Peek
|
This method is used to peek information from remote host(s).
|
Inherited methods
Begin
|
Start to buffer data written to the stream, so that everything will be sent when the Send method is called.
|
Close
|
Closes the stream.
|
Drop
|
Drop the data that has been buffered since the last call to the Begin method.
|
ReadLine
|
Read a line of text from the stream, like the LINE INPUT instruction.
|
Send
|
Send all the data, in one shot, since the last call to Begin.
|
Watch
|
Start or stop watching the stream file descriptor for reading or writing, after it has been opened.
|
События
Error
|
This event raises when some failed (for instance socket binding failed). Status property will turn to a value lesser than zero, and socket will be automatically closed.
|
Read
|
This event raises when some data arrives to the socket from a remote host.
|