Sending file over socket - https

D

Dave

I need to send a file over a socket to a https address. Do I need to do
anything differently than specify the address with the https, and port 443?

For instance,
string m_server= "https://www.webaddress.com"
int m_port= 443;
m_RecvBytes = new Byte[1000];
System.Net.IPHostEntry ipHostInfo =
System.Net.Dns.Resolve(m_server);
System.Net.IPAddress hostadd = ipHostInfo.AddressList[0];

m_EPhostSP = new IPEndPoint(hostadd, m_port);
etc.
 
A

Arne Vajhøj

Dave said:
I need to send a file over a socket to a https address. Do I need to do
anything differently than specify the address with the https, and port 443?

For instance,
string m_server= "https://www.webaddress.com"
int m_port= 443;
m_RecvBytes = new Byte[1000];
System.Net.IPHostEntry ipHostInfo =
System.Net.Dns.Resolve(m_server);
System.Net.IPAddress hostadd = ipHostInfo.AddressList[0];

m_EPhostSP = new IPEndPoint(hostadd, m_port);

Yes.

A normal socket and a SSL socket is significantly different even though
a SSL socket is added on top of a standard socket.

In theory you can do the SSL handshake yourself, but you don't want
to do that.

WebRequest (and WebClient I guess) do support HTTPS URL's, so
if you use that, then all the SSL stuff will be done for you.

If you really need the flexibility at the socket level (which you
probbaly do not if you just need HTTPS), then you should look for
a SSL socket library for .NET - such do exist.

Arne
 
D

Dave

I just need to send a file to a https address. Could someone point me to an
example where this is done.

Arne Vajhøj said:
Dave said:
I need to send a file over a socket to a https address. Do I need to do
anything differently than specify the address with the https, and port 443?

For instance,
string m_server= "https://www.webaddress.com"
int m_port= 443;
m_RecvBytes = new Byte[1000];
System.Net.IPHostEntry ipHostInfo =
System.Net.Dns.Resolve(m_server);
System.Net.IPAddress hostadd = ipHostInfo.AddressList[0];

m_EPhostSP = new IPEndPoint(hostadd, m_port);

Yes.

A normal socket and a SSL socket is significantly different even though
a SSL socket is added on top of a standard socket.

In theory you can do the SSL handshake yourself, but you don't want
to do that.

WebRequest (and WebClient I guess) do support HTTPS URL's, so
if you use that, then all the SSL stuff will be done for you.

If you really need the flexibility at the socket level (which you
probbaly do not if you just need HTTPS), then you should look for
a SSL socket library for .NET - such do exist.

Arne
 
A

Arne Vajhøj

Dave said:
I just need to send a file to a https address. Could someone point me to an
example where this is done.

Lookup WebRequest and WebClient in docs.

Note that a file can be uploaded both as raw and as form encoded.

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top