SocketError SocketClose(
Socket s);
The
SocketClose()
routine closes a socket and frees it. Use it to close and free a datagram socket. It is the routine to call when responding to a SE_CONNECTION_CLOSED exception.
SocketClose()
may be used on a socket in any state, will shut down both outgoing and incoming data, cleans up, and frees the socket.
See Also: SocketCloseSend().
Include: socket.goh
SocketError SocketCloseDomainMedium(
char *domain,
MediumAndUnit *mau,
Boolean force);
This routine "hangs up" the hardware aspect of a socket connection. You may request that it only do so if there are no socket connections using the medium. If you force the medium closed with socket connections using the medium, the connections will receive no notification (they will just get SE_CONNECTION_RESET errors); therefore, you should force the medium closed only in extreme situations.
This routine takes the following arguments:
MediumAndUnit
structure specifying which medium to "hang up".Include: socket.goh
SocketError SocketCloseSend(
Socket s)
The
SocketCloseSend()
routine only works with connected sockets. (You should always use
SocketClose()
to close a datagram socket.) It partially shuts down the socket, so that the socket can no longer send data.
SocketSend()
will return SE_SOCKET_CLOSED if passed such a partially closed socket. However, you can still receive data via the socket--among other things, this means that you can use
SocketRecv()
to check for an SE_CONNECTION_CLOSED exception.
SocketCloseSend()
sends an SE_CONNECTION_CLOSED exception packet to the other side of the connection.
Include: socket.goh
SocketError SocketConnect(
Socket s,
SocketAddress *addr,
int timeout);
To make a connection, call
SocketConnect()
. You will pass the socket created via
SocketCreate()
, the address to connect to, and a timeout value.
You cannot form a true connection using a datagram socket. However, you can use
SocketConnect()
with a datagram socket to specify a default destination address to use when sending packets.
This routine takes the following arguments:
SocketResolve()
.
The
SocketConnect()
routine returns a
SocketError
value. If the routine returns SE_NORMAL, then the connection was established successfully. If it returns SE_CONNECTION_REFUSED, the remote site wasn't prepared to accept the connection. If it returns SE_CONNECTION_ERROR, the connection didn't go through for some miscellaneous reason. If it returns SE_NON_UNIQUE_CONNECTION, then you're trying to create a connection that is identical to another connection: same source address, source port, destination address, destination port, and delivery type. There would be no way to tell these connections apart. If you try to open the same connection from both sides simultaneously, they may both fail with SE_NON_UNIQUE_CONNECTION.
Include: socket.goh
Socket SocketCreate(
SocketDeliveryType delivery);
To create a new socket, call
SocketCreate()
. You will need to specify the socket's delivery type: SDT_DATAGRAM, SDT_SEQ_PACKET (sequential packets), or SDT_STREAM. If it returns zero, there was an error: call
ThreadGetError()
to get the error value, a
SocketError
.
Include: socket.goh
GEOS SDK TechDocs
|
|
SocketBind() ...
|
SocketGetAddressController() ...