Eoc
Checks whether a TCP connection has been closed by the peer.
Syntax
`
Declare Function Eoc ( ByVal filenum As Long ) As Long
`
Usage
`
result = Eoc( filenum )
`
Parameters
`filenum`
A file number bound to an `Open Tcp` connection or an accepted TCP client.
Return Value
Returns true (-1) if the connection has ended, zero (0) otherwise.
Description
`Eoc` means "end of connection". It is intended for TCP file numbers, where `EOF` only says that no byte is immediately available to read. A TCP program can poll `Eof` to decide whether a read is ready and `Eoc` to decide whether the remote endpoint has closed the socket.
Calling `Eoc` on a non-TCP file number is an illegal function call.
Example
See `examples/network/opentcp/http-get.bas`.
Differences from QB

- New to FreeBASIC.

See also

- `Open Tcp`
- `Tcp Accept`
- `EOF`