Tcp Accept
Accepts a connection from an `Open Tcp Server` file number.
Syntax
`
Declare Function Tcp Accept ( [#]serverfilenum As Long ) As Long
`
Usage
`
clientfilenum = Tcp Accept( [#]serverfilenum )
`
Parameters
`serverfilenum`
A file number previously opened with `Open Tcp Server`.
Return Value
Returns a new client file number on success, or zero (`0`) on failure.
Description
`Tcp Accept` waits for the next incoming connection on a TCP server file number. It chooses a free file number for the accepted client and returns it to the program. The returned file number should be closed with `Close` when the connection is no longer needed.
The server file number remains open and may be passed to `Tcp Accept` again to accept another connection.
Example
See `examples/network/opentcp/http-server.bas` and `examples/network/opentcp/two-connections-selftest.bas`.
Differences from QB

- New to FreeBASIC.

See also

- `Open Tcp Server`
- `Open Tcp`
- `Eoc`
- `FreeFile`