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
27
votes
2 answers

curl: (58) Unable to load client key -8178

I am facing an SSL issue with the curlcommand. I want to reach an URL using my SSL client certificate and private key. This is my command: $ curl -k -v "https://myurl.com/" --cert ./certificate.pem --key ./private.key * About to connect() to…
hzrari
  • 1,803
  • 1
  • 15
  • 26
25
votes
2 answers

How to structure git repository for a client-server project

I will be doing a project that will have a distinct server side (.NET) and client side (JavaScript) which can be developed separately. Does it make more sense to have them as 2 separate git repositories or should they be rather one? What advantages…
Borek Bernard
  • 50,745
  • 59
  • 165
  • 240
25
votes
4 answers

Tracking the death of a child process

How could I track down the death of a child process without making the parent process wait until the child process got killed? I am trying a client-server scenario where the server accepts the connection from a client and forks a new process for…
codingfreak
  • 4,467
  • 11
  • 48
  • 60
23
votes
3 answers

One complex query vs Multiple simple queries

What is actually better? Having classes with complex queries responsible to load for instance nested objects? Or classes with simple queries responsible to load simple objects? With complex queries you have to go less to database but the class will…
Lieven Cardoen
  • 25,140
  • 52
  • 153
  • 244
22
votes
5 answers

How does the Half-Life 2 multiplayer protocol work?

I was wondering how the Half-Life 2 multiplayer protocol works in mods like Counter-Strike: Source or Day Of Defeat: Source. I believe that they use some kind of obfuscation and proprietary compression algorithm. I would like to know how different…
JtR
  • 20,568
  • 17
  • 46
  • 60
22
votes
2 answers

Sending a string via Bluetooth from a PC as client to a mobile as server

I need help by transferring a string from a PC to an Android mobile device via Bluetooth. The Android mobile device should act as a server and displays the string message on the screen of the device. The PC which is the client should send the string…
Elementary
  • 2,153
  • 2
  • 24
  • 35
22
votes
2 answers

How to keep the android client connected to the server even on activity changes and send data to server?

I initially implemented an async task in my activity which sends data to the server. But when i changed activities the connection was lost. To avoid this my approach was to implement a service that centralizes the network operation and sends data to…
gfernandes
  • 1,156
  • 3
  • 12
  • 29
21
votes
3 answers

Send intermittent status of request before sending actual response

I have a server, which takes few minutes to process a specific request and then responds to it. The client has to keep waiting for the response without knowing when it will complete. Is there a way to let the client know about the processing…
Thirupathi Thangavel
  • 2,418
  • 3
  • 29
  • 49
21
votes
6 answers

Java client/server application with sockets?

I'm writing a java package that will be called by another language (matlab). If my matlab process ends, I want the Java process to keep running. Whenever matlab starts again, it should be able to communicate with the existing running process. So…
griffin
  • 3,158
  • 8
  • 37
  • 34
20
votes
6 answers

Indy TCP Client/Server with the client acting as a server

How can Indy's TIdTCPClient and TIdTCPServer be used in the following scenario: Client ---------- initate connection -----------> Server ... Client <---------------command------------------- Server Client …
jpfollenius
  • 16,456
  • 10
  • 90
  • 156
20
votes
4 answers

What is the difference between request, response and server?

What is the difference between request, response and server?
user31363
  • 289
  • 1
  • 2
  • 7
20
votes
1 answer

SSL Socket connection

How can I create a SSL Socket connection? I realy need to create a keystore? This keystore should be shared with all my client applications? I have create a server with the following code: SSLServerSocketFactory sslserversocketfactory =…
Victor
  • 8,309
  • 14
  • 80
  • 129
19
votes
1 answer

how do i find an available port before bind the socket with the endpoint?

I'm developing a server-client application that uses 3 ports [TCP SOCKET .Net 4.0].. So the application gives the user the choice to set the port for the main socket only. but I want to let the server application to automatically find available port…
Murhaf Sousli
  • 12,622
  • 20
  • 119
  • 185
19
votes
3 answers

How to prevent SIGPIPE or prevent the server from ending?

A quite standard C++ TCP server program using pthreads, bind, listen and accept. I have the scenario that the server ends (read: crashes) when I kill a connected client. The reason for the crash is that the write() call on the file fails, thus the…
towi
  • 21,587
  • 28
  • 106
  • 187
19
votes
1 answer

Python service discovery: Advertise a service across a local network

I have a "server" python script running on one of the local network machines, which waits for clients to connect, and passes them some work to do. The server and client code have both been written, and are working as expected... The problem is, this…
Mazyod
  • 22,319
  • 10
  • 92
  • 157