Up: GEOS SDK TechDocs | Up | Prev: SocketGetAddressController() ... | Next: SocketRemoveLoadOnMsg() ...

SocketInterrupt()

SocketError SocketInterrupt(
        Socket 		s);

This routine attempts to interrupt a SocketAccept() or a SocketRecv() pending on the passed socket s.

SocketInterruptResolve()

SocketError SocketInterruptResolve(
        TCHAR 		*domain,
        byte 		*address,
        int  		addrSize);

This routine attempts to interrupt the resolution of the specified address.

This routine takes the following arguments:

domain
The name of the domain.
address
The address which is being resolved.
addrSize
The size of the address buffer.

Warnings: This function is unreliable. It may not interrupt the desired resolve call,if it executes before the resolve call has begun to be processed. If may also cause other, parallel resolve in the same domain to be interrupted.

SocketListen()

SocketError SocketListen(
        Socket 		s,
        int 		qSize);

To listen for incoming sequenced packet or stream connections, call SocketListen() . The socket must be bound to a port before it can listen. You may allow more than one connection through the port-specify the maximum number of connections as an argument to SocketListen() .

This routine takes the following arguments:

s
The Socket which should listen for incoming connections. The socket should be bound to a port.
qSize
The number of incoming connections which may be accepted via the socket.

The SocketListen() routine causes the passed socket to "listen" for accepting connections. If another socket is already listening at the port, the SocketListen() routine will return SE_PORT_ALREADY_LISTENING.

See Also: SocketBind(), SocketAccept(), SocketCheckReady().

Include: socket.goh

SocketOpenDomainMedium()

SocketError SocketOpenDomainMedium(
        SocketAddress 		*addr,
        int 		timeout);

This routine opens a "raw" connection using the specified medium. Exactly what is meant by a "raw" connection depends upon the domain involved. In the case of TCP, this routine will dial the modem and create a PPP connection to the PPP server--but will not send any TCP packets.

If there is already a "raw" connection, this routine will return SE_NORMAL, just as if it had just opened the connection.

If the device's phone is busy, this routine will return SE_MEDIUM_BUSY.

This routine takes the following arguments:

addr
The address to connect to.
timeout
How many 1/60 second ticks to wait for a connection. Pass SOCKET_NO_TIMEOUT to wait forever.

When done with the connection, close it with SocketCloseDomainMedium() .

See Also: SocketCloseDomainMedium().

Include: socket.goh

SocketRecv()

int SocketRecv(
        Socket 		s,
        void 		*buffer,
        int 		bufSize,
        int 		timeout,
        SocketRecvFlags 		flags,
        SocketAddress 		*addr);

The SocketRecv() routine receives data from the socket. After filling the passed buffer with data, the socket will discard its copy of the received data to make room for the next piece of incoming data.

To "peek" at the next packet of incoming data, call SocketRecv() and pass the SRF_PEEK flag. This allows you to get the size of the next packet of incoming data and even to non-destructively look at the contents of that packet.

When using packet-based delivery type sockets (sequenced packet or datagram delivery sockets), you can only receive whole packets-if you grab data from the socket, but don't grab all the data in the packet, the rest of the data will be lost. Thus, it's a good idea to establish a maximum packet size for sockets using these delivery types.If you're not sure how much room you'll need to receive a packet, call SocketRecv() with the SRF_PEEK flag-this allows you to "peek" at the incoming data without causing the socket to discard its copy.

The SocketRecv() routine takes the following arguments:

s
The socket from which to grab the data.
buffer
Buffer to fill with data.
bufSize
Size of the data buffer. If this smaller than the amount of data, and the socket delivery type is packet-based, the data that doesn't fit in the buffer will be lost; if the socket is a stream socket, then socket will retain the remaining data.
timeout
How many 1/60 second ticks to wait for incoming data. Pass SOCKET_NO_TIMEOUT to wait forever.
flags
This flags field allows you to specify some options. Set the SRF_ADDRESS flag if you want the address of the sending machine in addr . Set the SRF_URGENT flag to only receive a packet marked urgent. Set the SRF_PEEK flag to "peek" at the incoming packet, leaving it in the socket.
addr
If you pass the SRF_ADDRESS_FLAG, then pass an empty SocketAddress buffer. Make sure the buffer has room for the address data after the SocketAddress structure. The structure's SA_domain , SA_domainSize , and SA_addressSize fields should be initialized. If either the domain or address buffer isn't long enough to hold its string, the resulting truncated string will not be null-terminated.

The SocketRecv() routine returns the size of the received buffer. If this size is zero, there may be an error in the connection.

Include: socket.goh


Up: GEOS SDK TechDocs | Up | Prev: SocketGetAddressController() ... | Next: SocketRemoveLoadOnMsg() ...