Click here to Skip to main content
16,020,447 members
Please Sign up or sign in to vote.
2.60/5 (2 votes)
See more:
Is it possible to read the header of a packet before it is saved as a file, without
using a packet sniffer? I'm trying to find "in detail" the journey of a packet, but all I can find is general statements about this subject. I want to read the header of a packet so that I can grab the IP address and file type that is downloading. There has to be a point to do this further up the stack rather than at the socket level or higher using a packet sniffer.
Where else can I access this info to read and delete/or terminate the packet/download?
Thanks
DS
Posted
Updated 17-Apr-11 5:26am
v2

If your application is saving such a content, the answer is, of course yes.
On the other hand, if another application, out of your control, is saving the packet, then you cannot do that, unless you precisely sniff the packet or take somehow control of the other application.
 
Share this answer
 
Comments
Member 7766180 17-Apr-11 11:20am    
I can't do it by application. It would have to be before it reaches an application. As it goes down the OSI stack there must be some point that I can read and delete the packet before it becomes an actual file. I can't do it after it is downloaded because I won't know which directory it will end in.
Sergey Alexandrovich Kryukov 17-Apr-11 11:49am    
This comment if even more confusing. This forum is about programming. You say "before it reaches an application". What code goes before application?
--SA
Sergey Alexandrovich Kryukov 17-Apr-11 11:50am    
5 for the answer. We do not understand what code are we discussing, I'm not sure OP understands it well.
--SA
Member 7766180 17-Apr-11 12:30pm    
Is there anyway to read a packet header before the process is completed?
If you are not using a packet sniffer and the packet is not saved to a file then how would you 'see' the header?
 
Share this answer
 
Comments
Member 7766180 17-Apr-11 11:16am    
That is exactly my question. There has to be a logic to this. As the packet makes it way up through the OSI stack at what points can you grab the header to read and delete the packet if necessary. There has to be some point to grab it before it is saved to disk as a file.
[no name] 17-Apr-11 12:40pm    
Possibly, but I don't know exactly where; you would need to study the OSI stack in some detail in order to do it.

Member 7766180 17-Apr-11 17:05pm    
Is there someplace that I can study the stack in great detail?
[no name] 18-Apr-11 3:41am    
see here: http://www.google.co.uk/search?q=osi+stack&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-GB:official&client=firefox-a
Member 7766180 18-Apr-11 7:07am    
This is wonderful. Thank you so much for your help!
DS
Isn't this logical: if something is to be saved as a file, it means it already exists on the same machine as the file is supposed to be, so the answer is "yes"?

Bad Question, that's why my Answer maybe is not very useful. I don't care because this is not my fault. :-)
You could have at least explained what kind of networking code are your trying to create…

—SA
 
Share this answer
 
Comments
Member 7766180 17-Apr-11 11:21am    
Just want to read a packet header before the file is saved on the hard drive. You said that it already exists on the same machine, now just where would that be?
Sergey Alexandrovich Kryukov 17-Apr-11 11:47am    
How can I know that if I don't even see your code? You probably think there is only one way receive a packet?
--SA
Member 7766180 17-Apr-11 12:26pm    
Is there more than one way to receive a packet? If so please explain.
Sergey Alexandrovich Kryukov 17-Apr-11 12:52pm    
Explain what? All available or thinkable APIs and protocols? Makes no sense. I don't even know your platform and protocols. It's your turn: show some code and explain what you're trying to achieve.
--SA
Member 7766180 17-Apr-11 17:04pm    
No you don't have to explain all API's and protocols. Just the way to receive a packet. The only way I know is by the ethernet card or the wireless card. I am on the windows platform, code will be forthcoming. But first I am trying to understand where I can grab a packet.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900