Hot answers tagged

77

S is a server: let's say it's an HTTP server, so it'll use the well-known port number for HTTP, which is 80. I run it on a host with IP address 10.0.0.4, so it will be listening for connections on 10.0.0.4:80 (because that's where everyone will expect to find it). Inside S, I'm going to create a socket and bind it to that address: now, the OS knows that ...


41

A port is part of the address in the TCP and UDP protocols. It is used to help the OS identify which application should get the data that is received. An OS has to support ports to support TCP and UDP because ports are an intrinsic part of TCP and UDP. A socket is part of the interface the OS presents to applications to allow them to send and receive ...


39

Think of your machine as an apartment building: A port is an apartment number. A socket is the door of an apartment. An IP address is the street address of the building.


34

Well at the risk of sounding slightly cheesy: Ideas are timeless. By this I mean that the notion of a depth first search is goodness knows how old, but still totally relevant. Likewise, things that aren't totally platform and technology dependent tend to have a longer lifespan. If you learn things like Algorithms Data structures Paradigms and Concepts ...


28

... why would I rearrange the bytes ... when I already know that both, server and client run on little endian? Thats just unnecessary work to do. It's only unnecessary if you can guarantee your code will always run on little-endian architectures. If you intend for it to have a long life, it's worth the extra effort to avoid disturbing well-proven code ...


21

The UDP protocol does not guarantee that messages are delivered in order or delivered at all, but it does ensure that those messages which do get delivered are complete and unchanged by automatically including a 16-bit checksum. That means adding another 16-bit checksum on the application layer is usually redundant. ...usually.... First, with IPv4 (not ...


20

IP addresses are a 32 bit integer which we typically express as four octets for human purposes. You could get the number of addresses in a range by turning both into their 32 bit integer representations and subtracting.


19

That sounds like UDP hole punching Let A and B be the two hosts, each in its own private network; N1 and N2 are the two NAT devices; S is a public server with a well-known globally reachable IP address. A and B each begin a UDP conversation with S; the NAT devices N1 and N2 create UDP translation states and assign temporary external port numbers ...


19

An open TCP connection is a logical state. It does not imply that that data is always being sent back and forth. After the initial three-way handshake you've entered into the "connected" state. You're in that state until either a 3-way disconnect occurs or a keep-alive fails. During the lifetime of the connection, resources from the underlying "physical" ...


18

Socket programming (at least as the term is normally used) is programming to one specific network API. Sockets support IP-based protocols (primarily TCP and UDP)1. Network programming can be done using various other APIs. Windows has a number of protocol-independent APIs such as the WNet* and Net* functions. Older versions of Windows also used ...


16

imagine you have a drum. If you beat it 10 times a second that would give you the transmission rate. You can hear it from a hundred meters away in about a second (speed of sound) which is the propogation speed. Edit: 10 times a second being 10 bits of information send. You can beat faster, increasing the transmission rate, but you can't increase the speed ...


14

This scenario of "nuclear apocalypse by inadvertence" would require some inordinate incompetence at some point. Namely, we can imagine a buggy router which mixes some packets together, and sends the wrong packet to the wrong destination. And then, inexplicably, the military system which receives the packet which, by a stroke of bad luck, contains what that ...


13

I think Windows required applications to poll for IO until NT and Windows 95. Modern general purpose operating systems have pretty much eliminated the need for polling. When your application requests to read from a socket, the read function has to make a call to operating system kernel. The OS puts the calling thread into a suspended state. As network ...


12

Many businesses in the 60's and 70's used what was called "time-sharing" of remote computer resources. 1) The input was sent by a teletype machine which would send the inputs to the remote machine and the display was printed paper. 2) The program would run and the results would return on the teletype machine. Often the mainframe computer was thousands of ...


12

Theoretically, this depends on the specifics of the OS and network hardware. In practice, mainstream OSes and hardware use a push model based on interrupts for interaction between the hardware and the OS (and all the software controlled by the OS). Basically, an interrupt is a very, very low-level mechanism through which peripheral hardware can signal the ...


12

UDP packets are not guaranteed to arrive in order. You should use TCP for this.


11

You can't "network to get a job," it's impossible to do well, and it's a big turn-off to have someone get to know you and lose interest when you can't help them get a position at your company. Networking is like farming. You plant seeds, cultivate and weed consistently, and harvest at the right time. What you should do now is what you should always be ...


11

The old netchan was too intricate. The problem is to find a way to provide Go channel semantics on top of network hardware and software that, as always, finds a way to defeat all attempts at clean design. I will continue to ponder. -rob new netchan


11

Request-response vs. message pushing Some architectures and protocols were designed for request-response type of communication. In HTTP, the client asks the server to GET, POST, DELETE, HEAD etc. something, and the server responds (or fails to respond). In POP3, the server role is limited to answer the requests, nothing more. Some others are designed in a ...


11

You won't be able to get an accurate count without any information about whether the range crosses subnet boundaries and what those subnets are. For example, 10.10.7.0 - 10.10.8.255 is a contiguous range of 512 addresses in the context of a /16. If that range covers two /24 blocks, the count is 508 because each block has a network address and a broadcast ...


11

UDP does provide a checksum, however. The UDP checksum is only 16 bits. That means a 1 in 65536 chance of a corrupt packet passing the checksum. in UDP over IPv4 the checksum is optional, so a sender could theoretically end up sending a packet without a checksum. The checksum covers the IP/port information as well as the data. While this is useful in ...


10

You should look at broadcasting. This is technique of sending your packets to all devices (IP's) in a subnet. It would look something like that: Android 192.168.0.101: Send message packet to broadcast address 192.168.0.254 PC 192.168.0.110: Reply to 192.168.0.101's broadcast message Android now knows PC's IP address and can communicate directly It's ...


9

You could call it an address generically, or a socket address. From Wikipedia, "A socket address is the combination of an IP address and a port number."


8

someone told me that on networking,,,, money is easy, the job is easy, some told me... Choosing a career path by this method is a sure fire way to end up doing something that you don't enjoy. programming is best suit for me beacuse i'm very skilled and excellent at figures (sorry if it sounds like boasting).... Programming requires much more than ...


8

Basically, there wasn't a network. To do anything useful, you had to be co-located with the computer. So you took your cards to the ops centre, and put them in a box. The operators then loaded them into the card reader. Results were printed on paper or punched out on cards, and you once again went to the ops centre to pick them up. Later on, things like ...


8

OK, I am not a Ethernet hardware engineer, but I think I can take a stab at your question. When you write code to listen from a port, the following happens: Your application code blocks/sleeps/"selects"/polls until the OS signals that a packet has arrived (with an some bits in the IP header indicating that packet is associated with that particular "port" ...


8

I think it is definitely not OK to synchornize the clock in the system. User does not expect you to touch the system settings and many systems won't even let you to. All you need is to have a correlation to convert timestamp from one side's clock to the other side's clock. On the other hand you need this correlation to be rather precise, say at least to a ...


8

No, TCP will time out and request that a packet be re-sent, but there's no guaranteed transit time. TCP (typically) relies on IP, which can dynamically route packets, so there's no way to estimate how long it will/should take.


7

Many programmers are introverts, so yes I would say it is typical for developers. I would continue to go to the user group meetings. Networking takes work, and even if you're meeting 1 or 2 people a month, eventually that adds up. I would also go to events like code camps as well. And yes, bring a stack of business cards and introduce yourself. ...


7

However, the purpose of this is not to be a package manager, but instead a standard to follow when you want to implement a system that silently, automatically updates your software in the background. I'll look through apt and rpm! The problem is that what you want to do is building a package manager whether you like it or not. Your current ...



Only top voted, non community-wiki answers of a minimum length are eligible