cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Is it possible to simply write to a socket?

From: Guenter <lists_at_gknw.net>
Date: Fri, 13 Jul 2012 04:41:15 +0200

Hi Igor,
Am 13.07.2012 01:49, schrieb Igor Korot:
> I'm transferring the code from VB to C/C++ to make it cross-platform.
> In VB, there is following code:
>
> [code]
> Dim boundary As String = "---------------------------"&
> DateTime.Now.Ticks.ToString("x")
> Dim newLine As String = System.Environment.NewLine
> Dim boundaryBytes As Byte() =
> System.Text.Encoding.ASCII.GetBytes(newLine& "--"& boundary&
> newLine)
> Dim request As Net.HttpWebRequest = Net.WebRequest.Create(uri)
>
> request.ContentType = "multipart/form-data; boundary="& boundary
> request.Method = "POST"
> request.KeepAlive = True
> request.Credentials = Net.CredentialCache.DefaultCredentials
>
> Using requestStream As IO.Stream = request.GetRequestStream()
> requestStream.Write(boundaryBytes, 0, boundaryBytes.Length)
> End Using
> [/code]
>
> AFAIU, it just simply writes boundary bytes to the socket as an ASCII
> bytes sequence.
> There is post-ing involved, no form submittal
> Is it possible to do the same with libcurl?
although this might be possible with libcurl - if I were you I would use
Perl for this task; you have then a simple script which runs on almost
every platform, no hassle with IDEs, compilers and MS dotnet
redistributables install which you most likely need if you compile with
MSVC 2010, and finally easy to write with your favourite text editor ...

libcurl is more meant for high-level tasks which you dont want ...

Gün.

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-07-13