hb_inetAddress
hb_inetCleanup
hb_inetClearError
hb_inetClearPeriodCallback
hb_inetClearTimeLimit
hb_inetClearTimeout
hb_inetClose
hb_inetConnect
hb_inetConnectIP
hb_inetCount
hb_inetCreate
hb_inetCRLF
hb_inetDataReady
hb_inetDGram
hb_inetDGramBind
hb_inetDGramRecv
hb_inetDGramSend
hb_inetErrorCode
hb_inetErrorDesc
hb_inetFD
hb_inetGetAlias
hb_inetGetHosts
hb_inetGetRcvBufSize
hb_inetGetSndBufSize
hb_inetInit
hb_inetIsSocket
hb_inetPeriodCallback
hb_inetPort
hb_inetRecv
hb_inetRecvAll
hb_inetRecvEndblock
hb_inetRecvLine
hb_inetSend
hb_inetSendAll
hb_inetServer
hb_inetSetRcvBufSize
hb_inetSetSndBufSize
hb_inetstatus
hb_inetTimeLimit
hb_inetTimeout
Tag Archives: inet
hb_inetTimeout()
HB_INETTIMEOUT()
Get or change the timeout value of a socket
Syntax
HB_INETTIMEOUT( <socket> [, <nTimeout> ] ) -> nPreviousTimeout
Arguments
<socket> a socket previously created / opened
<nTimeout> is the new socket timeout value
Returns
Returns the previous timeout value of the socket
Description
Sets or changes the timeout value of the socket.
Compliance
Harbour
hb_inetTimeLimit()
HB_INETTIMELIMIT()
Get or change the time limit value of a socket
Syntax
HB_INETTIMELIMIT( <socket> [, <nTimeLimit> ) -> NIL
Arguments
<socket> a socket previously created / opened
<nTimeLimit>
Returns
Returns the previous time limit value of the socket
Description
Sets or changes the time limit value of the socket.
Compliance
Harbour
hb_inetStatus()
HB_INETSTATUS()
Get the status of a socket
Syntax
HB_INETSTATUS( <socket> ) -> nResult
Arguments
<socket> a socket previously created / opened
Returns
Returns 1 (one) if the socket exists, -1 if it does not
Compliance
Harbour
hb_inetSetSndBufSize()
HB_INETSETSNDBUFSIZE()
Set the send buffer size of a socket
Syntax
HB_INETSETSNDBUFSIZE( <socket>, <nSize> ) -> nSize
Arguments
<socket> a socket previously created / opened
nSize
Returns
Returns the passed nSize or -1 on error
Description
Sets the send buffer size of a socket
Compliance
Harbour
hb_inetSetRcvBufSize()
HB_INETSETRCVBUFSIZE()
Set the receive buffer size of a socket
Syntax
HB_INETSETRCVBUFSIZE( <socket>, nSize ) -> nSize
Arguments
<socket> a socket previously created / opened
nSize
Returns
Returns the passed nSize or -1 on error
Description
Sets the receive buffer size of a socket
Compliance
Harbour
hb_inetServer()
HB_INETSERVER()
Create a socket bound to a port
Syntax
HB_INETSERVER( <port> [, <cBindAddr> [, <nListenLimit> ]] ) -> SOCKET
Arguments
<port>
<cBindAddr>
<nListenLimit> is an internal parameter and rarely needs to be passed, defaults to 10
Returns
An INET socket
Description
Creates a server that can accept connections from client on a certain port.
If the computer on which hb_InetServer is called has more than one logical interface (e.g. one network card, one loopback and one PPP address), cBindAddr can be specified to select only one of these interfaces to accept connections for this process. This is useful when a server is present on two networks, and the service is to be available only in one of them. Also, the same port on other addresses is left free to be used, so you can have different server programs running for different networks but managing the same service. For example, an FTP server available to the internal network could be radically different from an FTP server available for the internet.
nListenLimit is the number of incoming connections accepted by kernel before the kernel has the chance to report them to the application program. If the sockets receive nListenLimit connections before accepting them all, the nListenLimit + 1 connection will be notified to be “busy” by the kernel. The default value of 10 is enough for even a heavy duty server.
On error, sets error description in the newly returned socket.
Compliance
Harbour
hb_inetSendAll()
HB_INETSENDALL()
Send data through a socket with blocking
Syntax
HB_INETSENDALL( <socket>, <cBuffer> [, <nLength> ] ) -> nResult
Arguments
<socket> a socket previously created / opened
<cBuffer>
<nLength>
Returns
The amount of data written, 0 (zero) if the socket is closed, or -1 on an error
Description
This function works exactly as hb_InetSend() but it ensures that all the data to be sent is written before returning.
Compliance
Harbour
hb_inetSend()
HB_INETSEND()
Sent data through a socket
Syntax
HB_INETSEND( <socket>, <cBuffer> [, <nLength> ] ) -> nResult
Arguments
<socket> a socket previously created / opened
<cBuffer>
<nLength>
Returns
The amount of data written, 0 (zero) if the socket is closed, or -1 on an error
Description
Send data being stored in a string over the socket.
The nLength parameter can be given to allow writing only a part of the string.
There is no guarantee that all of cBuffer will be sent, as this is a decision that is up to the OS; this function does not take care to ensure that the data is really sent; check the returned number and send the part that has not been sent.
To ensure that all the data is sent before the function returns, use the hb_InetSendAll() function.
On error, the error in the socket is set.
Compliance
Harbour
hb_inetRecvLine()
HB_INETRECVLINE()
Read a line from a socket
Syntax
HB_INETRECVLINE( <socket> [, @<nBytesRead>, [, <nMaxLength> ; [, <nBufSize> ]]] ) -> cResult
Arguments
<socket> a socket previously created / opened
<nBytesRead> must be passed by reference
<nMaxLength>
<nBufSize>
Returns
Line read
Description
Blocks the calling thread until a sequence CRLF is read from the socket. Incremental allocation and end-of-line checking are done in an efficient way.
If an error occurs, or if the stream is closed before a CRLF is read, the function returns nothing and sets the socket error.
The returned string does not contain the trailing CRLF sequence, so an empty line is effectively returned as an empty string.
If the nBytesRead parameter is given, it will contain the number of bytes read from the socket, including the CRLF sequence, so that in normal conditions, nResult will report a count equal to the length of the returned string plus 2. nBytesRead will be 0 if stream is closed before a CRLF sequence is read, and will be -1 on error.
An optional nMaxLength parameter can be given to allow a maximum character count before the data is returned anyway. If this number is reached before a CRLF sequence is encountered, nBytesRead will contain the value one.
Finally, a nBufSize parameter can be given. If not, memory allocation will be increased by discrete amounts of 80 bytes. The programmer can provide here a different allocation strategy (e.g. setting nBufSize equal to nMaxLength, memory for reading the line will be allocated only once, at the beginning of the function).
Compliance
Harbour