The Stack Overflow podcast is back! Listen to an interview with our new CEO.
116

S is a server program: 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 listen 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 ...


88

According to Wikipedia, Internet Protocol Version 5 was used by the Internet Stream Protocol, an experimental streaming protocol. The second version (of Internet Stream Protocol), known variously as ST-II or ST2, distinguishes its own packets with an Internet Protocol version number 5, although it was never known as IPv5. The Internet Stream ...


49

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.


45

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 ...


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.


18

Yes, portscans are considered a form of hacking, but a relatively low threat level (and pretty common), so it's unlikely to have any consequences except possibly getting your IP blocked. How else can one find out on which port the desired application is running (without the user input)? Applications typically run on a fixed "well-known" port that is ...


18

Sometimes you can use IP address. If you're on a LAN or are otherwise dealing exclusively with users that have IP's statically distributed to single clients, using that address is perfectly fine -- sometimes preferable and necessary. But, usually you can't. If you're running a public site, most of the IP addresses that hit your server aren't static or ...


15

Berkeley socket was just an API that was invented then. The technology that sockets abstracts away was there before; ARPANET and TCP/IP stack was invented in the 70's and there were computer networks even before that. Technically you can connect two computers with a serial cable an make them communicate over it.


13

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 ...


13

At its core, the problem is that software is complex. For any site, you have all of the JavaScript to make the site run. You have the server to handle requests. You have the cache to handle in flight data. You have the CDN to store all of the content. You have some database to store all of the data. You have backup servers where the data goes. You have ...


12

"So what happened to IPv5? IPv5 was used to define an experimental real-time streaming protocol. To avoid any confusion, it was decided to not use IPv5 and name the new IP protocol IPv6. " (Cisco CCNA Exploration Courses - Accessing the WAN) Here's a link! @ Hemant You will find there enhancements that IPv6 offers.


12

Are there any examples of such a system? Yes. This pattern is known as distributed computing(or distributed programming or whatever cool word you want to put after distributed). My suggestion will be not to build this in-house before looking at other solutions. You can look at this stack overflow question for various options. And then take calculated ...


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 ...


10

Back around 1980, I took a seminar class in discrete-event simulation from Nick Lawrence, who used to be THE discrete-event simulation wizard at Texas Instruments. He had saved them many millions of dollars, at a time when a million dollars was still real money. Nick hammered us on two things, over and over and over again. The first was purpose. What do ...


10

Three more reasons to add: Multiuser workstations and terminal servers exist. Many users could be running completely independent browser processes in separate sessions. IP addresses aren't persistent. It could be reassigned when a DHCP lease expires. The application should support roaming. For example, a user on a phone might drop out of WiFi range and ...


9

I know the TCP protocol binds itself to a port till the transfer of messages is over (port 80) A TCP connection is uniquely identified by the 4-tuple (source address, source port, dest address, dest port). The source and destination IP addresses will take care of themselves, but you're slightly confused about the ports. A port is just a 16-bit integer, ...


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

A computer has an IP address that identifies it as a separate entity on the network. We add an additional number to that to allow us to differentiate between connections to that computer. This is the port number. On the OS side of the connection you need buffers, connection state, etc. This logical object is the socket.


8

Topology is the study of fundamental properties that exist no matter the arrangement of elements (for example the ratio of points, edges and faces in a polygon that does not change as you add or reduce points). This term fits networks well because what you are looking for with network topology is the different arrangements of the network to perform the same ...


6

If the network in question has any kind of intrusion detection, scanning a significant number of ports will tend to throw up a flag and attract administrator attention. Depending on the policies in place and whether you are inside or outside the network, the response could be anything from blocking your scans to cutting off the machine doing the scan to ...


6

It is not a good idea to scan for ports. Port scanning probably will be against network policies. You should make it configurable which port to connect, and use a default if not configured specifically.


6

I've found this explanation in the context of Cassandra lightweight transactions useful. Prepare/promise is the core of the algorithm. Any node may propose a value; we call that node the leader. (Note that many nodes may attempt to act as leaders simultaneously! This is not a “master” role.) The leader picks a ballot and sends it to the participating ...


6

There are existing protocols for performing discovery of devices; it would be better to use one of these than roll your own. The leading competitors are mDNS (aka Bonjour) and SSDP (aka Universal Plug and Play). I'd suggest reading up on these, and then picking up one of the many open source implementations to start working from.


6

This is a legitimate concern of theirs, but this is best solved with a .pdf file rather than new software. Say instead of just you, you and a friend built this project and you both administer the server. Then, one day the friend decides he's going to pursue a new career of refilling ATMs in Antarctica, and will no longer have time to deal with your project. ...


5

Yes, size matters. Your co-worker's argument is that any amount of traffic up to the MTU will take the same amount of time to transmit, and that simply isn't true. Forget for a minute that you have any protocols at all, just a pipe where bits go in one end and (hopefully) make out out the other. If the pipe can transfer 8,000 bits per second, 500 bytes (4,...


5

I would argue that you're looking at too low of a level. You should be looking at message queues like ZeroMQ or others to build what's known as a service bus. ZeroMQ and most other message queue systems have client libraries for most popular languages and platforms. The connections are feather-light and scale highly. The message queues also support concepts ...


5

I've created a few low level networking programs in c#, mainly a protocol stack, and a chat messenger. The only issue I ever had was the overhead that comes along with using a high level language. You can still do all of the low level things like looking at packets, and reading individual bytes. Java & .NET both have built-in support for sockets and byte ...


5

It is not explicitly stated, but it is implied in the specification of the UDP protocol (RFC 768) that multiple packets that are sent independently are received independently. UPD stands for User Datagram Protocol, and it is the Datagram that is relevant here. A datagram is defined as A self-contained, independent entity of data carrying sufficient ...


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