By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,550 Members | 908 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,550 IT Pros & Developers. It's quick & easy.

Uploading Files

P: 21
When I execute the below code i get the following error "A socket operation was attempted to an unreachable host".

Expand|Select|Wrap|Line Numbers
  1. main_sock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
  2. main_ipEndPoint = new IPEndPoint(Dns.GetHostByName(server).AddressList[0], this.port);
  3.  
  4. main_sock.Connect(main_ipEndPoint);
Please help me in this regard.

Thanks and regards,

Govind
Jan 5 '10 #1
Share this Question
Share on Google+
6 Replies


tlhintoq
Expert 2.5K+
P: 3,525
TIP: When you are writing your question, there is a button on the tool bar that wraps the [code] tags around your copy/pasted code. It helps a bunch. Its the button with a '#' on it. More on tags. They're cool. Check'em out.
Jan 5 '10 #2

tlhintoq
Expert 2.5K+
P: 3,525
When I execute the below code i get the following error "A socket operation was attempted to an unreachable host".
What exactly do you need help with? The error message is very self explanatory. You tried to establish a connection with a host that can't be reached.

[Telephone operator recording]
"The number you have dialed is not a working number. Please check the number and dial again."
[end recording]
Jan 5 '10 #3

P: 21
Thanks for your reply.

But when i execute the code mentioned above in .NET 2.0 it gets executed successfully. I want to integrate it in .NET 1.1. How should i achieve this?

Thanks and regards,

Govind
Jan 5 '10 #4

tlhintoq
Expert 2.5K+
P: 3,525
I don't know for sure.
I would guess that you need to study the differences in how this done in 2.0 and 1.1 and make your code compliant with the 7 year old framework. Maybe 1.1 requires additional setup to be done before invoking this and 2.0 handles it quietly behind the scenes for you. Maybe it was just plain broke in 1.1 and fixed in 2.0. Who knows?

Either that or tell your client that they need to accept the inevitable update to framework 2.

Remind them that framework 4 is soon to be released and that staying so far behind the times is not in any way helping them. Framework updates are FREE.
Jan 5 '10 #5

P: 21
@tlhintoq
Thanks for your reply.

I need to upload files to a network shared drive in .NET 1.1. Can you please help me in this regard?

Thanks,

Govind
Jan 6 '10 #6

tlhintoq
Expert 2.5K+
P: 3,525
If it is a shared drive on your network, the just copy the file. It wouldn't be an 'upload'

System.IO.File.Copy(string Source, string Destination);
Jan 6 '10 #7

Post your reply

Sign in to post your reply or Sign up for a free account.