Navigation:  thinBasic Modules > TcpUdp (Networking) > TCP functions >

TCP_Open

Previous pageReturn to chapter overviewNext page

 

Description

 

Open a TCP/IP port or service name for communication.

 

Syntax

 

n = TCP_Open(sPortOrServiceName, sHost, nFile [, nTimeOut])

 

Returns

 

Number.

 

Parameters

 

Name

Type

Optional

Meaning

sPortOrServiceName

Any

No

This parameter can be either a port number or a service name. thinBasic will take care of it. For example to open a connection with a web server, either specify 80 or "HTTP". To open a connection with a SMTP server, either specify 25 or "SMTP"

sHost

String

No

IP number or server name

nFile

Number

No

File number. Use an unused file number. To get the first available file number, use TCP_FreeFile function

nTimeOut

Number

Yes

Time out in milliseconds. If no timeout, a standard 60000 milliseconds (60 seconds) will be used

 

Remarks

 

Restrictions

 

See also

 

Examples