473,772 Members | 2,552 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Question about Sockets

hi,

is it possible to use a Socket (proto_udp) and recieve icmp messages ?
what i want to do is, send a datagram to a remote host/port and check if
the host replies with port_unreachabl e (i think icmp type 3).
is this possible with a udp Socket and the RecieveFrom() method ?.
another approach would be (at least thats what i think) to use a raw
socket with proto_udp.
is this a wrong way to go ?

thanks
Nov 17 '05 #1
3 1398
Bernd schrieb:
hi,

is it possible to use a Socket (proto_udp) and recieve icmp messages ?
what i want to do is, send a datagram to a remote host/port and check if
the host replies with port_unreachabl e (i think icmp type 3).
is this possible with a udp Socket and the RecieveFrom() method ?.
another approach would be (at least thats what i think) to use a raw
socket with proto_udp.
is this a wrong way to go ?

thanks


Hi,

hhmmm, I think ICMP messages are not sent through UDP. So, I'm not sure
but I think its not possible to do that with a UDP Socket.

Yours sincerely

Andy
Nov 17 '05 #2

Andy Schmidt schrieb:
Bernd schrieb:
hi,

is it possible to use a Socket (proto_udp) and recieve icmp messages ?
what i want to do is, send a datagram to a remote host/port and check if
the host replies with port_unreachabl e (i think icmp type 3).
is this possible with a udp Socket and the RecieveFrom() method ?.
another approach would be (at least thats what i think) to use a raw
socket with proto_udp.
is this a wrong way to go ?

thanks

Hi,

hhmmm, I think ICMP messages are not sent through UDP. So, I'm not sure
but I think its not possible to do that with a UDP Socket.

Yours sincerely

Andy

ok, thanks for your answer. and yes you are right, icmp is not sent
through udp.
would it be possible to work with 2 sockets ? lets say i create an udp
socket, send a dgram and recieve the reply with a raw socket
proto_type_icmp ?

thanks
Nov 17 '05 #3
Bernd schrieb:


Andy Schmidt schrieb:
Bernd schrieb:

hi,

is it possible to use a Socket (proto_udp) and recieve icmp messages ?
what i want to do is, send a datagram to a remote host/port and check if
the host replies with port_unreachabl e (i think icmp type 3).
is this possible with a udp Socket and the RecieveFrom() method ?.
another approach would be (at least thats what i think) to use a raw
socket with proto_udp.
is this a wrong way to go ?

thanks

Hi,

hhmmm, I think ICMP messages are not sent through UDP. So, I'm not sure
but I think its not possible to do that with a UDP Socket.

Yours sincerely

Andy


ok, thanks for your answer. and yes you are right, icmp is not sent
through udp.
would it be possible to work with 2 sockets ? lets say i create an udp
socket, send a dgram and recieve the reply with a raw socket
proto_type_icmp ?

thanks


Hi,

ok, I've looked in W. Richard Stevens book "TCP/IP Volume 1" and found
out, that you can use the UDP Socket to receive the ICMP reply of your
sent datagram. In the ICMP message the IP-Header and the first 8 bytes
of the IP-Data are transmitted. And Stevens wrote: the ICMP module can
assiciate with this information an UDP Port and respectivly a process
with the ICMP reply.

Yours sincerely

Andy
Nov 17 '05 #4

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

Similar topics

2
2779
by: Chris | last post by:
Hi All, I've been puzzling over this, but can't find a satisfactory answer anywhere. I'm not sure if the problem is in my code, or if it's something to do with the PHP/Apache set-up (probably the former as I am self taught, and probably taught myself a lot of bad habits). Anyway, the problem is this: I have a database with about 7,000 or so URLs stored in it (amongst other things). I need to check these URLs once a month or so and I...
4
15625
by: Dr.Kadzija | last post by:
i have a client-server application. client and server should communicate via tcp sockets. ok, so i use Sockets, PrintWriter and BufferedReader. the problem is that: both client and server will send each other multiple lines (using PrintWriter.println()) at a time, and i don't know how many lines each of them will send. this wouldn't be a problem if a sender could end his turn with a pre-defined character or string (e.g. "\n", "bye" or...
0
1494
by: Richard L Rosenheim | last post by:
I'm playing around with setting up a multicast socket. I can create a socket for sending, and I can one that receives. Is it possible to create one socket that can do both? The code I've been basing my work on is the code in "IP Multicasting in C#" by Gary Brewer, http://www.codeproject.com/csharp/multicast.asp). The following is the code snippet that I have. I'm able to receive packets, but sending is hanging up.
4
2168
by: 0to60 | last post by:
I have a question about socket programming in general. Exactly what happens behind the scenes when I one socket connects to a different socket in listen mode? Using the dotnet framework, I create a socket, bind it to a port, put it in listen mode, and then n sockets can connect to it. The code: Socket newSocket = listeningSocket.Accept(); returns a socket. I can communicate on newSocket, and listeningSocket goes
0
295
by: Eternal Snow | last post by:
Hello. For some reason I need to send an IP package to myself (dest address is one of my ip addresses). (IP, not TCP/UDP) I've save the package datagram in byte array i(), included head and body with correct checksum. How can I send the byte array to me? I've tried to do so...
2
1434
by: ZorpiedoMan | last post by:
I'm new to the world of sockets, and this question is not VB specific: If multiple clients access the same server on the same port, and the server is set up to do some async communication, does the server's response back to all the clients on that port, or just to the one who sent the request? In other words: Client One - Request Data From Server (It takes a few seconds for the server to get the answer)
2
4277
by: Silby | last post by:
I've been messing around with sockets for a bit and i got most of it down (i think). The server side is an asynchronous tcp socket listener with sits and waits for data. The client side uses TcpClient to connect. Connecting, sending and receiving data, error handling, ... all works fine. The problem is when closing the connection. Now as i understand it, closing the socket works as follows: client -> tcp finish command
1
1550
by: Brian Henry | last post by:
Hello, I was tring to learn socket's (being i never used them before) and have a simple question. I want to create a listner that will get any data recieved and print it out. I've been able to get it to recieve only one line of data, but the next one i send to it wont be printed like the 1st one. I had a listner running in a thread, does anyone have a simple listner code example that would show how to have a tcplistner thread running...
2
15334
by: djc | last post by:
I read a network programming book (based on framework 1.1) which indicated that you should 'never' use the RecieveTimeout or the SendTimeout 'socket options' on TCP sockets or you may loose data. I now see the socket.RecieveTimeout 'property' in the visual studio 2005 help documentation (framework 2.0) and it has example of it being used with TCP socket. This propery is also listed as 'new in .net 2.0'. 1) is the socket.RecieveTimeout...
0
9621
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9454
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,...
0
10264
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10106
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10039
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
5355
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
4009
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3610
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2851
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.