Questions tagged [client-server]

DO NOT USE ALONE. The client-server model is a centralized model, in which a server performs a specialized service (such as HTTP, SMTP, etc.) for multiple clients on request. Use for issues regarding client server communication. Use with a appropriate language tag(eg: [python]).

The client-server centralized model is a model in which servers perform services for many clients, who request them, typically over a network. The client-server model contrasts with the peer-to-peer model.

Typically, a client-server interaction will work as such:

  1. The client connects to the server and issues a request. The request is formatted to any one of a number of protocols, depending on the server type.
  2. The server receives the request, and begins processing it. While this happens, the client is made to wait.
  3. The server sends the client a response which typically contains both a status (whether or not there was an error) and content (which is whatever the client asked for originally).
  4. The client or the server can either terminate the connection, or keep it alive for further requests.

Writing in a client-server domain presents a number of challenges:

  • Many, many clients may be requesting services at any given time. This issue is commonly faced by websites, and is typically solved with multiple layers of load-balancing and caching. Wikipedia's architecture is an example of this (albeit an unusually complex example).
  • Networks can easily become unreliable, and sessions can be terminated at any time.
  • Security can be an issue, due to security compromises like a Man In The Middle attack. Cryptography algorithms (like SSL) are widely deployed in various networking areas to combat this.
6508 questions
50
votes
3 answers

Very large HTTP request vs many small requests

I need a 2D array (as Json) to be sent from server to client. It would be around 400x400 in size with each entry around 4 characters of text. So that makes it around 640KB of data. Which of the following extreme approaches is better ? I make a…
Nikhil Garg
  • 3,944
  • 9
  • 30
  • 37
49
votes
5 answers

What is a simple C or C++ TCP server and client example?

I need to quickly implement a very small C or C++ TCP server/client solution. This is simply to transfer literally an array of bytes from one computer to another - doesn't need to be scalable / over-complicated. The simpler the better. Quick and…
Nick Bolton
  • 38,276
  • 70
  • 174
  • 242
49
votes
6 answers

Socket.IO Client Library in Python

Can anyone recommend a Socket.IO client library for Python? I've had a look around, but the only ones I can find are either server implementations, or depend on a framework such as Twisted. I need a client library that has no dependencies on other…
Ada
  • 1,746
  • 4
  • 15
  • 15
39
votes
6 answers

WCF - Inspect the messages being sent/received?

I have 2 solutions: - Server Solution - Client Solution The server registers itself to my localhost IIS: http://localhost/MyApp/ The client adds WCF Services (Service References) from the localhost application:…
michael
  • 14,844
  • 28
  • 89
  • 177
39
votes
2 answers

struct sockaddr_un vs. sockaddr

How is struct sockaddr different from struct sockaddr_un ? I know that we use these structures in client-server modules, for binding the socket to the socket address. And we use a cast operator for it to accept struct sockaddr_un. I want to know how…
Pavitar
  • 4,282
  • 10
  • 50
  • 82
36
votes
4 answers

How to share semaphores between processes using shared memory

I have to synchronize N client processes with one server. These processes are forked by a main function in which I declared 3 semaphores. I decided to use POSIX semaphores but I don't know how to share them between these processes. I thought that…
Sicioldr
  • 543
  • 3
  • 7
  • 13
36
votes
4 answers

Reliable way of generating unique hardware ID

Question: I have to come up with unique ID for each networked client, such that: it (ID) should persist once client software is installed on target computer, and should continue to persist if software is re-installed on same computer and same OS…
mr.b
  • 4,932
  • 11
  • 38
  • 55
30
votes
3 answers

Avoid caching of the http responses

What is the definitive solution for avoid any kind of caching of http data? We can modify the client as well as the server - so I think we can split the task between client and the server. Client can append to each request a random parameter…
STeN
  • 6,262
  • 22
  • 80
  • 125
29
votes
3 answers

Sending camera video from browser to server

Im trying out the new and exciting features of chrome canary 19. I can basically grab the video from the web-cam and set it to a source element for a video tag. Camera capture