Skip to content

OpenTCPStream

Narta Xaymar Dirks edited this page Nov 1, 2026 · 6 revisions

Blitz3DBlitzPlusBlitzBasic

OpenTCPStream

OpenTCPStream:Int32 server:String, server_port:Int32, local_port:Int32=0
Parameter Mode Type Default Description
server In String required The address of the server, as a name or as text: dotted numbers for IPv4, or an IPv6 address like ::1 (brackets are allowed). A name with several addresses tries them in the order the system prefers, until one connects.
server_port In Int32 required The port the server listens on.
local_port In Int32 0 The port to connect from. Defaults to 0, which lets the system pick one.

Returns: A TCP stream, or 0 when the connection could not be made.

Description

Connects to a TCP server. It returns once the connection is made or has failed.

Differences

  • IPv6 addresses and names that have them work. See IPv6.

Examples

; nothing listens on this port
Print OpenTCPStream("127.0.0.1", 40754)
0

Related Commands

AcceptTCPStream, CloseTCPServer, CloseTCPStream, CloseUDPStream, CreateUDPStream, GetTCPStreamAddress, TCPStreamIP, TCPStreamPort

Home · Command Index



Differences
Language Features
BlitzBasic
Blitz3D
BlitzPlus

Clone this wiki locally