473,594 Members | 2,756 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.IPHo stEntry ipHostInfo =
System.Net.Dns. Resolve(m_serve r);
System.Net.IPAd dress hostadd = ipHostInfo.Addr essList[0];

m_EPhostSP = new IPEndPoint(host add, m_port);
etc.
Jun 27 '08 #1
4 2746
On Fri, 18 Apr 2008 15:36:00 -0700, Dave <Da**@noWeb.com 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?
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.IPHo stEntry ipHostInfo =
System.Net.Dns. Resolve(m_serve r);
System.Net.IPAd dress hostadd = ipHostInfo.Addr essList[0];

m_EPhostSP = new IPEndPoint(host add, 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.IPHo stEntry ipHostInfo =
System.Net.Dns. Resolve(m_serve r);
System.Net.IPAd dress hostadd = ipHostInfo.Addr essList[0];

m_EPhostSP = new IPEndPoint(host add, 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
5544
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. I know there is a way to symmetrically encrypt files with the php mcrypt routines and already did implement a
4
5177
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 files. Or at least, it's not clear from the description of socket.ssl what it does if they're omitted. However, urlopen has no way to specify such things. Nor should it - for typical uses, a person simply trying to retrieve data from an ssl site...
1
2487
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 import sockets and setdefaulttimeout, however, using m2crypto.urllib tends to cause a http.BadStatusLine to be raised, even if the timeout is set to be very large. All of the documents in the test script can be accessed publicly. Any ideas? Is...
4
8195
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 TcpClient, NetworkStream and StreamWriter classes. but with low level socket it doesn't work (When using the Socket class Send method).
1
8168
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 the members of my organization. I think my problem is incorrectly setting the settings on my server or an authentication problem. Here is the code I have written to send a test message: -----Code Begins: Sensitive Information Replaced by -----...
6
4259
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 avoid a "page cannot be displayed". All other interaction with the application works well.
3
4280
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 receiver is running within Process1. If I move the receiver into Process2 then its fast. Please can someone explain.
0
3153
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 System.Collections.Generic; using System.Net; using System.Net.Sockets; using System.Runtime.Serialization.Formatters.Binary;
5
2235
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: sprintf(request, "POST /accounts/ClientLogin HTTP/1.0\r\nContent-type: application/x-www-form-urlencoded\r\nContent-length:1357\r \nEmail=myemail@sina.com&Passwd=mypasswd&service=lh2&source=sd-aa-1.0\r \n");
0
7876
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8003
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8234
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6654
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5739
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5408
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3859
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
1478
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1210
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.