cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Only want to open TCP port

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Thu, 23 Feb 2012 14:03:48 +0100

On Wed, Feb 22, 2012 at 8:08 PM, Gaylord Yu <gyu5point0_at_yahoo.com> wrote:
> However, can someone tell me how to do the following with libcurl (or if it
> is even possible in libcurl):
> I simply want to open a TCP socket at a particular IP address and port.
> Then I want to send specific text string (e.g. "Hello world") to that TCP
> port.
> I don't want HTTP or FTP, just simply send a text string to a specific TCP
> port.

On Wed, Feb 22, 2012 at 09:31:31PM -0800, Alan Wolfe wrote:
> I think it is possible actually!
>
> Libcurl supports telnet, which is essentially what you want.

telnet has its own negotiation protocol that can get in the way of a raw
transfer. But libcurl can still do this with a combination of
CURLOPT_CONNECT_ONLY and curl_easy_recv() & curl_easy_send(). But that
begs the question--why? If that's all you're doing, just use raw
sockets instead.

>>> Dan
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-02-23