473,382 Members | 1,086 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Sending file over socket - https

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.
Jun 27 '08 #1
4 2718
On Fri, 18 Apr 2008 15:36:00 -0700, Dave <Da**@noWeb.comwrote:
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?
Using Socket? Yes. Using Socket, you'll be responsible for all of the
application-level protocol issues related to HTTPS, such as encryption.

..NET has built-in classes that wrap HTTP communications and take care of
the protocol-specific stuff for you. I think it's possible it has similar
for HTTPS, though I don't know off hand what those classes would be.

Pete
Jun 27 '08 #2
Dave wrote:
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
Jun 27 '08 #3
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" wrote:
Dave wrote:
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
Jun 27 '08 #4
Dave wrote:
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
Jun 27 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Philipp Brune | last post by:
Hi all, the following problem occured to me and I hope somebody can help me : I need to implement an encrypted File download with a PHP script on the server side and a c# client application....
4
by: Gary Feldman | last post by:
I think I've found a deficiency in the design of urllib related to https. In order to complete an https connection, it appears that URLOpener and hence FancyURLOpener require the key and cert...
1
by: John Hunter | last post by:
I have a test script below which I use to fetch urls into strings, either over https or http. When over https, I use m2crypto.urllib and when over http I use the standard urllib. Whenever, I...
4
by: yaron | last post by:
Hi, I have a problem when sending data over TCP socket from c# client to java server. the connection established ok, but i can't send data from c# client to java server. it's work ok with...
1
by: Eric Sheu | last post by:
Greetings, I have been searching the web like mad for a solution to my SMTP problem. I am using Windows Server 2003 and ASP.NET 2.0 w/ C# to send out e-mails from a web site I have created to...
6
by: chris | last post by:
Client page: <input type="file".....> Server: Apache, OC4J, J2EE app XP, SP1 and updates Works perfectly under HTTP. However, under HTTPS the user needs to hit the submit button really fast to...
3
by: BuddyWork | last post by:
Hello, Could someone please explain why the Socket.Send is slow to send to the same process it sending from. Eg. Process1 calls Socket.Send which sends to the same IP address and port, the...
0
by: Buddy Home | last post by:
There is two examples of code. Example 1. Send and Receive within the same process. Put this code in a console app called SendAndReceive and run the code. using System; using...
5
by: lanclot | last post by:
hi i am trying to authenticate a user using ClientLogin by sending a post to https://www.google.com/accounts/ClientLogin in my c program use ssl and socket the next code is my request:...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.