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



.



Relevant Pages

  • VB Net Socket Error?
    ... I wrote a few lines of code to send a UDP packet to a remote machine. ... if I give the sendto statement a bogus IP or port (that is not open ... Dim txString() As Byte = Encoding.ASCII.GetBytes ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Cant ssh
    ... Are you using IMAP and ... I have never used Putty so I do not know ... > more remote machine. ... the Linux box is also not serving my webmin page on port ...
    (Debian-User)
  • Re: Netcat (NC) Secure Remote Connections via authenication
    ... >> I have a requirement were I need to connect to a remote machine and ... >> leave the port open for anyone to connect. ... Evaluating SSL VPNs' Consider NEOTERIS, chosen as leader by top analysts! ...
    (Security-Basics)
  • Re: IIS 5.0 Creating a new WEBSITE with VS.NET
    ... Like I said, if you create an application on port 81, ... Juan T. Llibre ... > from remote machine I am not able to browse it. ... but as a individual site under IIS server. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: ssh & port 22 problem
    ... ssh & port 22 problem ... > When I try to connect from a remote machine to my one at home ... If you have a home router between your linux box and the net you ... you need to check that sshd is running on your system. ...
    (Fedora)

Loading