Yes, for an active connection, you would use connect() function. For connect() function to succeed, a listening socket has to be in place on the remote host to accept the incoming connection. If connect() returns RTCS_OK, the application can use the socket to transfer data, send() and recv() functions in case of stream socket. So it can recv() whatever characters via the socket, parse received characters and execute commands as needed by application.
You can pass an established socket into telnet server functionality in MQX - by using the socket from successful connect(). Function TELNETSRV_sockinit() starts the telnet server with an existing socket.