TCP socket (client) connection in Swift4

Hi.

We are trying to connect a TCP socket (client) But our project does not even recognize the TCPClient method.

Tell us the basic structure of connecting TCP sockets (clients) and what to import.

Replies

There are many different APIs for running a TCP connection on Apple’s platforms. The API I generally recommend is CFSocketStream, exposed to Swift as

Stream
. Start with
getStreamsToHost(withName:port:inputStream:outputStream:)
and follow the links from there.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"