Google Mail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Socket Error?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Follow-up To:
Add Cc | Add Follow-up to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers that you hear
 
 
View profile   Translate to Translated (View Original)
 More options 7 Dec 2005, 15:23
Newsgroups: microsoft.public.dotnet.framework
From: <Buc>
Date: Wed, 7 Dec 2005 09:23:15 -0600
Local: Wed 7 Dec 2005 15:23
Subject: Socket Error?
I wrote a few lines of code to send a UDP packet to a remote machine. What
worries me is the program code says it sends the data regardless of the
remote IP or port. If the IP is ok , a sniffer verifies the packet was sent.
However, if I give the sendto statement a bogus IP or port (that is not open
on the remote machine), the code executes with no errors. I know UDP is
connection-less, but the framework should balk at the bad or port (or at
least it does in C or VB6). Any ideas how to get an error return? I used to
get a destination or port unreachable error in VB6, when I did a sendto with
a bogus IP or closed port. Heres the code:
Lets say my network is 192.168.0.0..
Dim txString() As Byte = Encoding.ASCII.GetBytes("test")
txSocket = New Socket(AddressFamily.InterNetwork, SocketType.Dgram,
ProtocolType.Udp)
Dim txEP As New IPEndPoint(IPAddress.Parse("172.18.1.99"), 2967)
Try
  Dim r = txSocket.SendTo(txString, txEP) 'returns 5 bytes data sent to 172
network (ip not exist)
  Console.WriteLine(r)
Catch ex As Exception
 Console.WriteLine(ex.Message)
 End Try
Thanks,
BUC

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Goran Sliskovic  
View profile   Translate to Translated (View Original)
 More options 8 Dec 2005, 10:37
Newsgroups: microsoft.public.dotnet.framework
From: "Goran Sliskovic" <gslis...@yahoo.com>
Date: Thu, 8 Dec 2005 11:37:09 +0100
Local: Thurs 8 Dec 2005 10:37
Subject: Re: Socket Error?

<Buc> wrote in message news:%23wOmTO1%23FHA.2588@TK2MSFTNGP10.phx.gbl...
> I wrote a few lines of code to send a UDP packet to a remote machine. What
> worries me is the program code says it sends the data regardless of the
> remote IP or port. If the IP is ok , a sniffer verifies the packet was
sent.
> However, if I give the sendto statement a bogus IP or port (that is not
open
> on the remote machine), the code executes with no errors. I know UDP is
> connection-less, but the framework should balk at the bad or port (or at
> least it does in C or VB6). Any ideas how to get an error return? I used
to
> get a destination or port unreachable error in VB6, when I did a sendto
with
> a bogus IP or closed port. Heres the code:
> Lets say my network is 192.168.0.0..

...

Hi,
You should not count on sendto returning destination unreachable error when
host is unreachable. Only one special case exists when system can know that
host is unreachable and that is when local computer has no route to that
host. If you have default gataway or route to destination, you will never
get destination unreachable (sendto will return immediatly, buffering the
request to the OS). "Port unreachable" is not listed in error codes of
windows socket API. The only way you can tell that host is unreachable is by
time-out on host reply.

When using UDP, you must provide your own flow controll, error
detection/correction and retransmition. Plus be aware that UDP lacks
congestion controll, witch can have very unpleasant consequences on your
whole network if you are not aware of that.

Regards,
Goran


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google