![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Section contents
This chapter describes the Socket class which provides a client endpoint to a protocol. It provides functions for socket creation, reading, writing, passive connection, active connection, setting addresses and querying addresses.
csocket.oxh
this& = NewSocket&:
Create a socket object and returns a handle to the created object.
this& |
A handle which represents the created socket |
If the object could not be created then an error is generated
which should be trapped by an ONERR
handler.
LOCAL this& this& = NewSocket&: DeleteSocket:(this&)
DeleteSocket:(BYREF this&)
Destroys the socket object.
BYREF this& |
A handle for a socket object. A zero value is written back into the variable |
LOCAL this& this& = NewSocket&: DeleteSocket:(this&)
SocketAcceptA:(this&,socket&,BYREF status&)
The function facilitate client/server connection from a remote socket. The call extracts the first pending connection on a queue of sockets, the queue size being previously specified by SocketListen. On successful completion the blank socket is given the handle of the new socket and it may then be used to transfer data. After completion the accept socket may be used to make further connections with new blank sockets (see SocketOpen on how to open a blank socket).
SocketAcceptA may be used for protocols which do not have the KSIConnectionLess& flag in their protocol information.
this& |
A handle for a socket object |
socket& |
A handle for a socket object |
BYREF status& |
The status of the asynchronous operation |
LOCAL server&,socket&,blank&,address&,status&,err% server&=NewSocketServ&: socket&=NewSocket&: blank&=NewSocket&: address& = NewInetAddr4&:(KInetAddrLoop&,7) err% = SocketServConnect%:(server&,KSockDefaultMessageSlots&) err% = SocketOpen4%:(socket&,server&,KAfInet&,KSockStream&) err% = SocketBind%:(socket&,address&) err% = SocketListen%:(socket&,1) err% = SocketOpen%:(blank&,server&); SocketAcceptA:(socket&,blank&,status&) IOWAITSTATUS32 status& SocketClose:(blank&) SocketCancelAll:(socket&) SocketClose:(socket&) DeleteInetAddr:(address&) DeleteSocket:(blank&) DeleteSocket:(socket&) DeleteSocketServ:(server&)
If the status&
object cannot be created then
an error is generated which should be trapped by an ONERR
handler.
SocketAccept2A, SocketBind, SocketCancelAccept, SocketListen, SocketOpen
SocketAcceptA:(this&,socket&,des&,BYREF status&)
The function facilitate client/server connection from a remote socket. The call extracts the first pending connection on a queue of sockets, the queue size being previously specified by SocketListen. On successful completion the blank socket is given the handle of the new socket and it may then be used to transfer data. After completion the accept socket may be used to make further connections with new blank sockets (see SocketOpen on how to open a blank socket).
An additional descriptor argument to receive data which may have been sent in a connect request. If there is a pending connection in the listen queue when SocketAccept2A is called, the call will complete immediately. Otherwise it will wait until a socket becomes available in the queue and complete asynchronously.
SocketAccept2A may be used for protocols which do not have the KSIConnectionLess& flag in their protocol information.
This routine must only be used with protocols which support
the KSiConnectData&
attribute in the protocol service
information.
this& |
A handle for a socket object |
socket& |
A handle for a socket option |
des& |
A handle for a descriptor object |
BYREF status& |
The status of the asynchronous operation |
If the status&
object cannot be created then
an error is generated which should be trapped by an ONERR
handler.
SocketAcceptA, SocketBind, SocketCancelAccept, SocketListen
err% = SocketBind%:(this&,address&)
Use this function to set the local address of a socket. When a socket is opened it has no name associated with it, and binding is required so data can be routed to the socket. SocketBind should be called before SocketListen or SocketConnect. The address supplied should be a derived class specific to the particular protocol the socket was opened on.
this& |
A handle for a socket object |
address& |
A handle to a socket address object |
err% |
An error code |
LOCAL server&,socket&,blank&,address&,status&,err% server&=NewSocketServ&: socket&=NewSocket&: blank&=NewSocket&: address& = NewInetAddr&:(KInetAddrLoop&,7) err% = SocketServConnect%:(server&,KSockDefaultMessageSlots&) err% = SocketOpen4%:(socket&,server&,KAfInet&,KSockStream&) err% = SocketBind%:(socket&,address&) err% = SoxketListen%:(socket&,1) SocketAcceptA:(socket&,blank&,status&) IOWAITSTATUS32 status& SocketCancelAll:(socket&) SocketClose:(socket&) DeleteInetAddr:(address&) DeleteSocket:(blank&) DeleteSocket:(socket&) DeleteSocketServ:(server&)
SocketCancelAccept:(this&)
Cancel an accept operation.
this& |
A handle for a socket object |
SocketCancelAll:(this&)
Cancel all outstanding operations
this& |
A handle for a socket object |
SocketCancelRead, SocketCancelRecv, SocketCancelSend, SocketCancelWrite
SocketCancelConnect:(this&)
Cancel any connect operations.
this& |
A handle for a socket object |
SocketCancelIoctl:(this&)
Cancel any ioctl operations.
this& |
A handle for a socket object |
SocketCancelRead:(this&)
Cancel a read operation.
this& |
A handle for a socket object |
SocketCancelRecv:(this&)
Cancel any outstanding recv operations.
this& |
A handle for a socket object |
SocketCancelAll, SocketRecvA, SocketRecvFromA, SocketRecvOneOrMoreA
SocketCancelSend:(this&)
Cancel any outstanding send operations.
this& |
A handle for a socket object |
SocketCancelAll, SocketCancelWrite, SocketSend, SocketSendTo
SocketCancelWrite:(this&)
Cancel any outstanding write operations.
this& |
A handle for a socket object |
SocketCancelAll, SocketCancelSend, SocketWrite
SocketClose:(this&)
Use this function to close a socket. If a socket has been opened using SocketOpen then it should be closed using SocketClose. This will ensure all associated resources are released.
Closing serves two distinct purposes:
If a socket is connected, then calling close is equivalent to calling SocketShutdownA with an argument of KStopNormal&, synchronously waiting for the request to complete, and then closing the IPC channel. If asynchronous or alternative methods of disconnecting are required then SocketShutdown should be called before SocketClose.
this& |
A handle for a socket object |
LOCAL server& LOCAL this& LOCAL err% LOCAL address& address& = NewInetAddr4&:(INET_ADDR(192,10,1,5),7) server& = NewSocketServ&: this& = NewSocket&: err% = SocketServConnect%(server&) err% = SocketOpen4:(this&,server&,KAfInet&,KSockStream&,KUndefinedProtocol&) SocketConnect:(socket&,address&,status&) IOWAITSTAT32 status& SocketClose:(socket&) DeleteInetAddr:(address&) DeleteSocket:(socket&) DeleteSocketServ:(server&)
If the SocketServ session on which a protocol was opened is closed, then all sockets associated with that session will be abortively closed and any further requests on the sockets will result in panics.
If a protocol has the flag KSiGracefulClose& in its protocol information, when SockClose is called on a connected socket, the socket will synchronously block until a response to a close request has been received or some other protocol condition causes the call to complete.
SocketConnectA:(this&,address&,BYREF status&)
Use this functions to connect to a remote host. The address provided specifies the address of the remote host. A socket may only have one connect operation outstanding at any one time. Once the connect is completed, the socket is ready to send or receive data. If a socket is unbound i.e. SocketBind has not been called yet then it will automatically have a local address allocated.
SocketConnect is always required for protocols which do not have the KSiConnectionLess& flag in their protocol information. If a protocol has the KSiConnectionLess& flag, then SocketConnect may be used to set the address for all data sent from the socket, in which case SocketSend/SocketWrite may be used in addition to SocketSendTo.
this& |
A handle for a socket object |
address& |
A handle for a socket address object |
BYREF status& |
The status of the asynchronous operation |
If the status&
object cannot be created then
an error is generated which should be trapped by an ONERR
handler.
LOCAL server& LOCAL this& LOCAL err% LOCAL address& address& = NewInetAddr4&:(INET_ADDR(192,10,1,5),7) server& = NewSocketServ&: this& = NewSocket&: err% = SocketServConnect%(server&) err% = SocketOpen4:(this&,server&,KAfInet&,KSockStream&,KUndefinedProtocol&) SocketConnectA:(socket&,address&,status&) IOWAITSTAT32 status& SocketClose:(socket&) DeleteInetAddr:(address&) DeleteSocket:(socket&) DeleteSocketServ:(server&)
SocketCancelConnect, SocketClose, SocketConnect2
SocketConnect2A:(this&,address&,outDes&,inDes&,BYREF
status&)
Use this functions to connect to a remote host. The address provided specifies the address of the remote host. Some protocols allow data to be sent in connect request packets which may be provided in the data-out descriptor. Some protocols may allow data to be sent in connect responses which may be collected in the data-in descriptor. A socket may only have one connect operation outstanding at any one time. Once the connect is completed, the socket is ready to send or receive data. If a socket is unbound i.e. SocketBind has not been called yet then it will automatically have a local address allocated.
SocketConnect2A is always required for protocols which do not have the KSiConnectionLess& flag in their protocol information. If a protocol has the KSiConnectionLess& flag, then SocketConnect2A may be used to set the address for all data sent from the socket, in which case SocketSend/SocketWrite may be used in addition to SocketSendTo.
This routine must only be used with protocols which support
the KSiConnectData&
attribute in the protocol service
information.
this& |
A handle for a socket object |
address& |
A handle for a socket address object |
outDes& |
A handle for a descriptor object |
inDes& |
A handle for a descriptor object |
BYREF status& |
The status of the asynchronous operation |
If the status&
object cannot be created then
an error is generated which should be trapped by an ONERR
handler.
SocketCancelConnect, SocketClose, SocketConnect
err% = SocketGetDisconnectData%:(this&,des&)
Returns data in the descriptor des&
that was
included in a protocol disconnect message.
This routine must only be used with protocols which support
the KSiDisconnectData&
attribute in the protocol service
information.
this& |
A handle for a socket object |
des& |
A handle to a descriptor object |
err% |
The result of the operation |
err% = SocketGetOpt$:(this&,optionName%,optionLevel%,des&)
Use these functions to get a socket option. The socket server has options which are generic to all sockets and protocols may add specific options.
this& |
A handle for a socket object |
optionName% |
Specifies the socket option name |
optionLevel% |
Specifies the socket option level |
des& |
A handle for a descriptor object |
err% |
The result of the operation |
SocketGetOptInt, SocketSetOpt, SocketSetOptInt
err% = SocketGetOpt$:(this&,optionName%,optionLevel%,BYREF option&)
Use these functions to get an integer socket option. The socket server has options which are generic to all sockets and protocols may add specific options.
this& |
A handle for a socket object |
optionName% |
Specifies the socket option name |
optionLevel% |
Specifies the socket option level |
BYREF option& |
An integer which is used to hold the value of the option obtained |
err% |
The result of the operation |
SocketGetOpt, SocketSetOpt, SocketSetOptInt
err% = SocketInfo%:(this&,buffer&)
Use this function to get information in the protocol description for the protocol which a socket is opened on.
this& |
A handle for a socket object |
buffer& |
A handle for a protocol description object |
err% |
The result of the operation |
SocketIoctlA:(this&,command%,BYREF status&,des&,level%)
Use this function to apply an asynchronous control operation on a socket. Data may be passed and received if a descriptor address is provided as an argument. Only one SocketIoctlA operation may be outstanding for each socket.
this& |
A handle for a socket object |
command% |
Specifies the ioctl command to perform |
BYREF status& |
The status of the asynchronous operation |
des& |
A handle for a descriptor object |
level% |
Control operation level |
If the status&
object cannot be created then
an error is generated which should be trapped by an ONERR
handler.
err% = SocketListen%:(this&,size%)
Use the function to set up a socket to listen for incoming connections. Before calling this procedure a socket should be opened on a specific protocol using SocketOpen and the socket should be bound to a local address using SocketBind. SocketListen creates a queue to hold incoming connections which can be married with blank sockets using SocketAccept. The call also allows data to be sent back to connecting peers if a protocol allows data to be passed in connect responses. Once a listen queue has been created it will continue to allow peers to connect until it is full, at which point it will reject any incoming connections as specified by protocol behaviour. When a socket is accepted by the client a space is made available in the queue.
this& |
A handle for a socket object |
size% |
The size of the listen queue |
err% |
The result of the operation |
LOCAL server&,socket&,blank&,address&,status&,err% server&=NewSocketServ&: socket&=NewSocket&: blank&=NewSocket&: address& = NewInetAddr&:(KInetAddrLoop&,7) err% = SocketServConnect%:(server&,KSockDefaultMessageSlots&) err% = SocketOpen4%:(socket&,server&,KAfInet&,KSockStream&) err% = SocketBind%:(socket&,address&) err% = SoxketListen%:(socket&,1) SocketAcceptA:(socket&,blank&,status&) IOWAITSTATUS32 status& SocketCancelAll:(socket&) SocketClose:(socket&) DeleteInetAddr:(address&) DeleteSocket:(blank&) DeleteSocket:(socket&) DeleteSocketServ:(server&)
SocketAcceptA, SocketAccept2A, SocketBind, SocketListen2
err% = SocketListen2%:(this&,size%,des&)
Use the function to set up a socket to listen for incoming connections. Before calling this procedure a socket should be opened on a specific protocol using SocketOpen and the socket should be bound to a local address using SocketBind. SocketListen creates a queue to hold incoming connections which can be married with blank sockets using SocketAccept. The call also allows data to be sent back to connecting peers if a protocol allows data to be passed in connect responses. Once a listen queue has been created it will continue to allow peers to connect until it is full, at which point it will reject any incoming connections as specified by protocol behaviour. When a socket is accepted by the client a space is made available in the queue.
This routine must only be used with protocols which support
the KSiConnectData&
attribute in the protocol service
information.
this& |
A handle for a socket object |
size% |
The size of the listen queue |
des& |
A handle for a descriptor object |
err% |
The result of the operation |
SocketAcceptA, SocketAccept2A, SocketBind, SocketListen
SocketLocalName:(this&,address&)
Use this function to get the local address of a socket. The local address is set either by calling SocketBind or it is automatically set when SocketConnect is called. If a socket is created through SocketAccept then a socket will inherit the port of its parent unless otherwise specified by a protocols behavior. Depending on a protocol implementation, additional information may be gained through this call.
this& |
A handle for a socket object |
address& |
A handle for a socket address object |
port% = SocketLocalPort%:(this&)
Use this function to get the local port of a socket. The local ports is set either by calling SocketBind or it is automatically set when SocketConnect is called. If a socket is created through SocketAccept then a socket will inherit the port of its parent unless otherwise specified by a protocols behavior. Depending on a protocol implementation, additional information may be gained through this call.
this& |
A handle for a socket object |
port% |
The port of the local connection |
err% = SocketName%:(this&,des&)
<TBS>
this& |
A handle for a socket object |
des& |
A handle for a descriptor object |
err% |
The result of the operation |
err% = SocketOpen%:(this&,server&)
Opens a blank channel to the socket server. A socket opened in this way has can be used with the SocketAcceptA function.
this& |
A handle for a socket object |
server& |
The socket server session; a SocketServ object |
err% |
The result of the operation |
SocketAccept, SocketClose, SocketOpen2, SocketOpen4
err% = SocketOpen2%:(this&,server&,name$)
The opens a channel to a protocol protocol identified by name. If a socket is the first to be opened for a protocol it will have the additional affect of loading the protocol in the socket server.
this& |
A handle for a socket object |
server& |
The socket server session; a SocketServ object |
name$ |
The name of a protocol |
err% |
The result of the operation |
SocketClose, SocketOpen, SocketOpen4
err% = SocketOpen4%:(this&,server&,family&,sockType&,protocol&)
The opens a channel to a protocol protocol identified by contstants. If a socket is the first to be opened for a protocol it will have the additional affect of loading the protocol in the socket server.
this& |
A handle for a socket object |
server& |
The socket server session; a handle to a SocketServ object |
family& |
Specifies the address family |
sockType& |
Specifies the socket type |
protocol& |
Specifies the protocol |
err% |
The result of the operation |
LOCAL this&,server&,address&,err% address& = NewInetAddr4&:(INET_ADDR(192,10,1,5),7) server& = NewSocketServ&: this& = NewSocket&: err% = SocketServConnect%(server&) err% = SocketOpen4:(this&,server&,KAfInet&,KSockStream&,KUndefinedProtocol&) SocketConnect:(socket&,address&,status&) IOWAITSTAT32 status& SocketClose:(socket&) DeleteInetAddr:(address&) DeleteSocket:(socket&) DeleteSocketServ:(server&)
SocketClose, SocketOpen, SocketOpen2
SocketReadA:(this&, des&,BYREF status%)
Use this function to receive data from a remote host.
SocketReadA should only be used with connected sockets.
On completion the descriptor will be filled with data up to its maximum length. A socket may only have one receive operation outstanding at any one time.
this& |
A handle for a socket object |
des& |
A handle for a descriptor object |
BYREF status& |
The status of the asynchronous operation |
If the status&
object cannot be created then
an error is generated which should be trapped by an ONERR
handler.
SocketRecvA, SocketRecv2A, SocketFromA, SocketRecvFrom2A, SocketRecvOneOrMore2A
SocketRecvA:(this&,des&,flags&,BYREF status%)
Use this function to receive data from a remote host. Flags are provided to add protocol specific information.
SocketRecvA should only be used with connected sockets.
On completion the descriptor will be filled with data up to its maximum length. A socket may only have one receive operation outstanding at any one time.
If a protocols information flag is marked with KSiPeekData&, then KSockReadPeek& may be provided as a flag to SockRecvA. All other flags are protocol specific.
this& |
A handle for a socket object |
des& |
A handle for a descriptor object |
flags& |
Specifies socket recv flags |
BYREF status& |
The status of the asynchronous operation |
If the status&
object cannot be created then
an error is generated which should be trapped by an ONERR
handler.
SocketReadA, SocketRecv2A, SocketFromA, SocketRecvFrom2A, SocketRecvOneOrMore2A
SocketRecv2A:(this&,des&,flags&,BYREF status%,BYREF xfrLength&)
Use this function to receive data from a remote host. Flags are provided to add protocol specific information.
SocketRecv2A should only be used with connected sockets.
On completion the descriptor will be filled with data up to its maximum length. If less than the maximum length of the descriptor is available to be filled then an extra length argument can be provided. A socket may only have one receive operation outstanding at any one time.
If a protocols information flag is marked with KSiPeekData&, then KSockReadPeek& may be provided as a flag to SockRecv2A. All other flags are protocol specific.
this& |
A handle for a socket object |
des& |
A handle for a descriptor object |
flags& |
Specifies socket recv flags |
BYREF status& |
The status of the asynchronous operation |
BYREF xfrLength& |
A handle for a socket transfer length object |
If the status&
object cannot be created then
an error is generated which should be trapped by an ONERR
handler.
SocketReadA, SocketRecvA, SocketFromA, SocketRecvFrom2A, SocketRecvOneOrMore2A
SocketRecvFromA:(this&,des&,address&,flags&,BYREF status%)
Use this function to receive data from a remote host. Flags are provided to add protocol specific information.
SocketRecvFromA should be used on unconnected sockets where a source address is returned.
On completion the descriptor will be filled with data up to its maximum length. A socket may only have one receive operation outstanding at any one time.
If a protocols information flag is marked with KSiPeekData&, then KSockReadPeek& may be provided as a flag to SockRecvFromA. All other flags are protocol specific.
this& |
A handle for a socket object |
des& |
A handle for a descriptor object |
address& |
A handle to a socket address which is a remote source address for unconnected receives |
flags& |
Specifies socket recv flags |
BYREF status& |
The status of the asynchronous operation |
SocketReadA, SocketRecvA, SocketRecv2A, SocketRecvFrom2A, SocketRecvOneOrMore2A
SocketRecvFrom2A:(this&,des&,address&,flags&,BYREF status%,BYREF xfrLength&)
Use this function to receive data from a remote host. Flags are provided to add protocol specific information.
SocketRecvFrom2A should be used on unconnected sockets where a source address is returned.
On completion the descriptor will be filled with data up to its maximum length. If less than the maximum length of the descriptor is available to be filled then an extra length argument can be provided. A socket may only have one receive operation outstanding at any one time.
If a protocols information flag is marked with KSiPeekData&, then KSockReadPeek& may be provided as a flag to SockRecvFrom2A. All other flags are protocol specific.
this& |
A handle for a socket object |
des& |
A handle for a descriptor object |
address& |
A handle to a socket address which is a remote source address for unconnected receives |
flags& |
Specifies socket recv flags |
BYREF status& |
The status of the asynchronous operation |
BYREF xfrLength& |
A handle for a socket transfer length object |
If the status&
object cannot be created then
an error is generated which should be trapped by an ONERR
handler.
SocketReadA, SocketRecvA, SocketRecvFrom, SocketRecvOneOrMore2A
SocketRecvOneOrMoreA:(this&,des&,flags&,BYREF status%)
Use this function to receive data from a remote host.
Flags are provided to add protocol specific information.
SocketRecvOneOrMoreA
should only be used with connected sockets.
On completion the
descriptor will be filled with data up to its maximum length. If
less than the maximum length of the descriptor is available to be
filled then an extra length argument can be provided. A socket
may only have one receive operation outstanding at any one time.
If a protocols
information flag is marked with KSiPeekData&, then KSockReadPeek& may be provided as a flag to SockRecvOneOrMoreA. All other flags are protocol
specific.
|
|
|
|
|
|
|
If the status&
object cannot be created then an error is generated which should
be trapped by an ONERR
handler.
This routine should no longer be used as a serious flaw has been found in it's implementation; instead use SocketRecvOneOrMore2A
SocketRecvOneOrMore2A:(this&,des&,flags&,length&,BYREF status%)
Use this function to receive data from a remote host. Flags are provided to add protocol specific information.
SocketRecvOneOrMore2A should only be used with connected sockets.
On completion the descriptor will be filled with data up to its maximum length. If less than the maximum length of the descriptor is available to be filled then an extra length argument can be provided. A socket may only have one receive operation outstanding at any one time.
If a protocols information flag is marked with KSiPeekData&, then KSockReadPeek& may be provided as a flag to SockRecvOneOrMore2A. All other flags are protocol specific.
this& |
A handle for a socket object |
des& |
A handle for a descriptor object |
flags& |
Specifies socket recv flags |
length& |
A socket transfer length for the returned length |
BYREF status& |
The status of the asynchronous operation |
If the status&
object cannot be created then
an error is generated which should be trapped by an ONERR
handler.
SocketRemoteName:(this&,address&)
Use this function to get the remote name of a socket. The remote name of a socket is associated with the remote host a socket is connected to. The remote name is only valid for a connected socket. A socket is either connected through calling SocketConnect or SocketAccept.
this& |
A handle for a socket object |
address& |
A handle for a socket address object |
LOCAL server&,socket&,blank&,address&,remote&,status&,err% server&=NewSocketServ&: socket&=NewSocket&: blank&=NewSocket&: address& = NewInetAddr4&:(KInetAddrLoop&,7) remote& = NewInetAddr&: err% = SocketServConnect%:(server&,KSockDefaultMessageSlots&) err% = SocketOpen4%:(socket&,server&,KAfInet&,KSockStream&) err% = SocketBind%:(socket&,address&) err% = SocketListen%:(socket&,1) err% = SocketOpen%:(blank&,server&); SocketAcceptA:(socket&,blank&,status&) IOWAITSTATUS32 status& SocketRemoteName:(blank&,remote&) PRINT InetAddrOutput$:(remote&) SocketClose:(blank&) SocketCancelAll:(socket&) SocketClose:(socket&) DeleteInetAddr:(remote&) DeleteInetAddr:(address&) DeleteSocket:(blank&) DeleteSocket:(socket&) DeleteSocketServ:(server&)
SocketSendA:(this&, des&, flags&, BYREF status&)
Use this function to send data to a remote host. Flags are provided to add protocol specific information.
SocketSendA should only be used with connected sockets.
A socket may only have one send operation in progress at any one time.
this& |
A handle for a socket object |
des& |
A handle for a descriptor object |
flags& |
Specifies socket send flags |
BYREF status& |
The status of the asynchronous operation |
If the status&
object cannot be created then
an error is generated which should be trapped by an ONERR
handler.
SocketSend2A, SocketSentToA, SocketSendTo2A, SocketWriteA
SocketSend2A:(this&, des&, flags&, BYREF status&,
xfrLength&)
Use this function to send data to a remote host. Flags are provided to add protocol specific information.
SocketSend2A should only be used with connected sockets.
An additional argument can be provided to indicate the amount of data sent. The length of the descriptor indicates the amount of data to be sent. A socket may only have one send operation in progress at any one time.
this& |
A handle for a socket object |
des& |
A handle for a descriptor object |
flags& |
Specifies socket send flags |
BYREF status& |
The status of the asynchronous operation |
xfrLength& |
A handle for a socket transfer length object |
If the status&
object cannot be created then
an error is generated which should be trapped by an ONERR
handler.
SocketSendToA:(this&, des&, address&,
flags&, BYREF status&)
Use this function to send data to a remote host. Flags are provided to add protocol specific information.
SocketSendToA should be used with a destination address on unconnected sockets.
A socket may only have one send operation in progress at any one time.
this& |
A handle for a socket object |
des& |
A handle for a descriptor object |
address& |
A handle for a socket address object |
flags& |
Specifies socket send flags |
BYREF status& |
The status of the asynchronous operation |
If the status&
object cannot be created then
an error is generated which should be trapped by an ONERR
handler.
SocketSendA, SocketSendTo2A, SocketWriteA
SocketSendTo2A:(this&, des&, address&,
flags&, BYREF status&, xfrLength&)
Use this function to send data to a remote host. Flags are provided to add protocol specific information.
SocketSendTo2A should be used with a destination address on unconnected sockets.
An additional argument can be provided to indicate the amount of data sent. The length of the descriptor indicates the amount of data to be sent. A socket may only have one send operation in progress at any one time.
this& |
A handle for a socket object |
des& |
A handle for a descriptor object |
address& |
A handle for a socket address object |
flags& |
Specifies socket send flags |
BYREF status& |
The status of the asynchronous operation |
xfrLength& |
A handle for a socket transfer length object |
If the status&
object cannot be created then
an error is generated which should be trapped by an ONERR
handler.
SocketSendA, SocketSendToA, SocketWriteA
err% = SocketSetLocalPort%:(this&,port&)
Use this function to set the local port of a socket. Setting the local port is equivalent to calling SocketBind with only the port set in the address.
this& |
A handle for a socket object |
port& |
The port to set |
err% |
An error code |
err% = SocketSetOpt$:(this&, optionName%,
optionLevel%, des&))
Use this function to set a socket option. The socket server has options which are generic to all sockets and protocols may add specific options.
this& |
A handle for a socket object |
optionName% |
Specifies the socket option name |
optionLevel% |
Specifies the socket option level |
des& |
A handle for a descriptor object |
err% |
The result of the operation |
SocketGetOpt, SocketGetOptInt, SocketSetOptInt
err% = SocketSetOptInt$:(this&, optionName%,
optionLevel%, option&))
Use this function to set an integer socket option. The socket server has options which are generic to all sockets and protocols may add specific options.
this& |
A handle for a socket object |
optionName% |
Specifies the socket option name |
optionLevel% |
Specifies the socket option level |
option& |
The value of the option to be set |
err% |
The result of the operation |
SocketGetOpt, SocketGetOptInt, SocketSetOpt
SocketShutdownA:(this&,how&,BYREF status&)
Use these functions to asynchronously shutdown a connected socket. The shutdown method allows input and output to be individually stopped for a protocol endpoint. For protocols which support data-in disconnect message, additional arguments are provided.
this& |
A handle for a socket object |
how& |
The shutdown type to be performed |
BYREF status& |
The status of the asynchronous operation |
If the status&
object cannot be created then
an error is generated which should be trapped by an ONERR
handler.
SocketShutdownA can be used for protocols which do not have the KSiConnectionLess& flag in their protocol information.
There is no way to cancel a socket shutdown once it has started.
SocketShutdown2A:(this&,how&,outDes&,inDes&,BYREF status&)
Use these functions to asynchronously shutdown a connected socket. The shutdown method allows input and output to be individually stopped for a protocol endpoint. For protocols which support data-in disconnect message, additional arguments are provided.
This routine must only be used with protocols which support
the KSiConnectData&
attribute in the protocol service
information.
this& |
A handle for a socket object |
how& |
The shutdown type to be performed |
outDes& |
A handle for a descriptor object |
inDes& |
A handle for a descriptor object |
BYREF status& |
The status of the asynchronous operation |
If the status&
object cannot be created then
an error is generated which should be trapped by an ONERR
handler.
SocketShutdown2A can be used for protocols which do not have the KSiConnectionLess& flag in their protocol information.
There is no way to cancel a socket shutdown once it has started.
err% = SocketTransfer$:(this&,server&,des&))
<TBS>
this& |
A handle for a socket object |
server& |
The socket server session; a handle to a SocketServ object |
des& |
A handle for a descriptor object |
err% |
The result of the operation |
err% = SocketWrite%:(this&,str$)
Use this function to send data to a remote host.
SocketWriteA should only be used with connected sockets.
A socket may only have one send operation in progress at any one time.
this& |
A handle for a socket object |
str$ |
A string to write |
err% |
The result of the operation |
SocketSendA, SocketSendToA, SocketSendTo2A
SocketWriteA:(this&,des&,BYREF&nbsstatus&)
Use this function to send data to a remote host.
SocketWriteA should only be used with connected sockets.
An additional argument can be provided to indicate the amount of data sent. The length of the descriptor indicates the amount of data to be sent. A socket may only have one send operation in progress at any one time.
this& |
A handle for a socket object |
des& |
A handle for a descriptor object |
BYREF status& |
The status of the asynchronous operation |
If the status&
object cannot be created then
an error is generated which should be trapped by an ONERR
handler.
SocketSendA, SocketSendToA, SocketSendTo2A
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |