On this page:
17.1 TCP Signature
tcp^
tcp-listen
tcp-connect
tcp-connect/  enable-break
tcp-accept
tcp-accept/  enable-break
tcp-accept-ready?
tcp-close
tcp-listener?
tcp-abandon-port
tcp-addresses
17.2 TCP Unit
tcp@

17 TCP: Unit and Signature🔗ℹ

The net/tcp-sig and net/tcp-unit libraries define a tcp^ signature and tcp@ implementation, where the implementation uses racket/tcp.

Some units in the "net" collection import tcp^, so that they can be used with transports other than plain TCP. For example, url@ imports tcp^.

See also tcp-redirect and make-ssl-tcp@.

17.1 TCP Signature🔗ℹ

 (require net/tcp-sig) package: net-lib

signature

tcp^ : signature

procedure

(tcp-listen port-no    
  [max-allow-wait    
  reuse?    
  hostname])  tcp-listener?
  port-no : (integer-in 0 65535)
  max-allow-wait : exact-nonnegative-integer? = 4
  reuse? : any/c = #f
  hostname : (or/c string? #f) = #f

procedure

(tcp-connect hostname    
  port-no    
  [local-hostname    
  local-port-no])  
input-port? output-port?
  hostname : string?
  port-no : (integer-in 1 65535)
  local-hostname : (or/c string? #f) = #f
  local-port-no : (or/c (integer-in 1 65535) #f) = #f

procedure

(tcp-connect/enable-break hostname 
  port-no 
  [local-hostname] 
  local-port-no) 
  
input-port? output-port?
  hostname : string?
  port-no : (integer-in 1 65535)
  local-hostname : (or/c string? #f) = #f
  local-port-no : (or/c (integer-in 1 65535) #f)

procedure

(tcp-accept listener)  
input-port? output-port?
  listener : tcp-listener?

procedure

(tcp-accept/enable-break listener)  
input-port? output-port?
  listener : tcp-listener?

procedure

(tcp-accept-ready? listener)  boolean?

  listener : tcp-listener?

procedure

(tcp-close listener)  void?

  listener : tcp-listener?

procedure

(tcp-listener? v)  boolean?

  v : any/c

procedure

(tcp-abandon-port tcp-port)  void?

  tcp-port : port?

procedure

(tcp-addresses tcp-port [port-numbers?])

  
(or/c (values string? string?)
      (values string? (integer-in 1 65535)
              string? (integer-in 1 65535)))
  tcp-port : port?
  port-numbers? : any/c = #f

17.2 TCP Unit🔗ℹ

 (require net/tcp-unit) package: net-lib

value

tcp@ : unit?

Imports nothing and exports tcp^, implemented using racket/tcp.