Questions tagged [network-programming]

Programming associated with creating and managing networks as well as adding network connectivity to a (set of) programs.

Programming associated with creating and managing networks as well as adding network connectivity to a (set of) programs. This tag is designated for software related interfacing with networking protocols. Typically, the term is not associated with interfacing with the hardware, but basic knowledge of how the hardware processes network packets can be crucial in debugging connectivity problems.

Documentation

Linux

Windows

11298 questions
385
votes
22 answers

Artificially create a connection timeout error

I've had a bug in our software that occurs when I receive a connection timeout. These errors are very rare (usually when my connection gets dropped by our internal network). How can I generate this kind of effect artificially so I can test our…
Mark Ingram
  • 71,849
  • 51
  • 176
  • 230
351
votes
12 answers

Recommended way to get hostname in Java

Which of the following is the best and most portable way to get the hostname of the current computer in Java? Runtime.getRuntime().exec("hostname") vs InetAddress.getLocalHost().getHostName()
Mahendra
  • 3,647
  • 2
  • 16
  • 16
277
votes
1 answer

What browsers support HTML5 WebSocket API?

I am going to develop an instant messaging application that runs in the browser. What browsers support the WebSocket API?
Sareuon
  • 2,787
  • 3
  • 16
  • 3
259
votes
9 answers

What is the Difference Between read() and recv() , and Between send() and write()?

What is the difference between read() and recv(), and between send() and write() in socket programming in terms of performances, speed and other behaviors?
Sajad Bahmani
  • 17,325
  • 27
  • 86
  • 108
225
votes
6 answers

java.net.URLEncoder.encode(String) is deprecated, what should I use instead?

I get the following warning when using java.net.URLEncoder.encode: warning: [deprecation] encode(java.lang.String) in java.net.URLEncoder has been deprecated What should I be using instead?
Frank Krueger
  • 69,552
  • 46
  • 163
  • 208
206
votes
7 answers

TCP: can two different sockets share a port?

This might be a very basic question but it confuses me. Can two different connected sockets share a port? I'm writing an application server that should be able to handle more than 100k concurrent connections, and we know that the number of ports…
K J
  • 4,505
  • 6
  • 27
  • 45
170
votes
5 answers

How is TeamViewer so fast?

Sorry about the length, it's kinda necessary. Introduction I'm developing a remote desktop software (just for fun) in C# 4.0 for Windows Vista/7. I've gotten through basic obstacles: I have a robust UDP messaging system, relatively clean program…
Jason
  • 6,878
  • 5
  • 41
  • 55
169
votes
7 answers

How many socket connections can a web server handle?

Say if I was to get shared, virtual or dedicated hosting, I read somewhere a server/machine can only handle 64,000 TCP connections at one time, is this true? How many could any type of hosting handle regardless of bandwidth? I'm assuming HTTP works…
David
  • 2,083
  • 3
  • 17
  • 14
163
votes
9 answers

How can I interrupt a ServerSocket accept() method?

In my main thread I have a while(listening) loop which calls accept() on my ServerSocket object, then starts a new client thread and adds it to a Collection when a new client is accepted. I also have an Admin thread which I want to use to issue…
lukeo05
  • 1,833
  • 2
  • 14
  • 13
161
votes
3 answers

What's the difference between streams and datagrams in network programming?

What's the difference between sockets (stream) and sockets (datagrams)? Why use one over the other?
RoR
  • 15,934
  • 22
  • 71
  • 92
160
votes
6 answers

socket connect() vs bind()

Both connect() and bind() system calls 'associate' the socket file descriptor to an address (typically an ip/port combination). Their prototypes are like:- int connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen); and…
Siddhartha Ghosh
  • 2,988
  • 5
  • 18
  • 25
158
votes
13 answers

Difference between TCP and UDP?

What is the difference between TCP and UDP? I know that TCP is used in the case of non-time critical applications, and UDP is used for games or applications that require fast transmission of data. I know that TCP is used for HTTP, HTTPs, FTP, SMTP,…
user749414
  • 1,597
  • 2
  • 10
  • 4
153
votes
7 answers

Netty vs Apache MINA

They both provide roughly the same functionality. Which one should I choose to develop my high-performance TCP server? What are the pros & cons? Reference links: Apache MINA (source) Netty (source)
GabiMe
  • 18,105
  • 28
  • 76
  • 113
145
votes
6 answers

Comparing HTTP and FTP for transferring files

What are the advantages (or limitations) of one over the other for transferring files over the Internet? (I am aware of secure forms of both protocols. I'd like to hear comparisons through personal experiences in terms of performance, reliability,…
Mystic
  • 5,024
  • 4
  • 29
  • 31
140
votes
6 answers

difference between socket programming and Http programming

What is the difference between socket programming and Http programming? can anyone help please?
Innovative Thinker
  • 1,735
  • 2
  • 14
  • 24
1
2 3
99 100