Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I have been wondering this for a few days. I basically understand how networks and packets work. But what happends when an unexpected packet arrives? Like, when I didn't send a request for a website's index, but it sends the index to my machine anyways ? Does my browser pop up? Does it ignore it? Anyway to actually catch it?

share|improve this question

closed as not a real question by Yusubov, Dynamic, gnat, Martijn Pieters, Walter Jan 26 '13 at 22:55

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

1  
Consider what is meant by "unexpected" -- there is no program registered to handle that packet. Thus, an unexpected packet is ignored. In your example, if there were a program registered to listen for spontaneous HTTP responses, then the packets wouldn't really be "unexpected", would they? There would be some service waiting for them. –  apsillers Jan 26 '13 at 19:57

1 Answer 1

up vote 6 down vote accepted

Simple : It gets thrown away.

If either TCP, or network layer can't accept the packet, then it is thrown away. This might happen if port is not open or packet was re-send, but original packet arrived, so it is not necessary anymore.

TCP and most network system contains rigorous checks on what packets to accept and what packet are bad or corrupted in some way. If such packet arives, it is ignored and client requests a re-send.

share|improve this answer
1  
Actually, if it's a TCP packet, a response is sent back to the originating machine refusing to accept the packet. –  Ross Patterson Jan 26 '13 at 22:41
    
@RossPatterson: Sometimes. A lot of systems are configured to not respond whatsoever to unexpected packets. –  whatsisname Jan 27 '13 at 5:59

Not the answer you're looking for? Browse other questions tagged or ask your own question.