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
19
votes
4 answers

Is it possible to run a socket server and socket client on the same machine?

In java it is possible to create a socket server and a socket client, is it possible to have an instance of the socket server running and a socket/server client that is receiving data from the socket server on the same machine? e.g the socket server…
Aaron
  • 11,239
  • 18
  • 58
  • 73
18
votes
9 answers

javascript library for client side storage with server side sync

I'm looking for a javascript library that will let me store data in a client side database and in the back ground automatically sync the database back to the server's database preferable something that supports a variaty of engines in the same way…
18
votes
4 answers

Client - server integration testing: mock or not?

I'm working on project with two applications: android app (client) and rest service (server). My android app consumes my rest service. Both applications are tested separately to ensure they're doing their business as expected. During server tests I…
18
votes
2 answers

How to give to a client specific ip address in C

I am trying to implement a simple client and server in C and I can't find online an example how to set a specific IP address to the client. This is what I got so far: sockfd = socket(PF_INET, SOCK_STREAM, 0); if (sockfd == -1) {
Alex
  • 1,054
  • 6
  • 25
  • 42
17
votes
4 answers

Multi-client, async sockets in c#, best practices?

I am trying to gain a better understanding of tcp/ip sockets in c#, as i want to challenge myself to see if i can create a working MMO infrastructure (game world, map, players, etc) purely for educational purposes as i have no intention of being…
Jason Miesionczek
  • 14,268
  • 17
  • 76
  • 108
17
votes
5 answers

How the clients (client sockets) are identified?

To my understanding by serverSocket = new ServerSocket(portNumber) we create an object which potentially can "listen" to the indicated port. By clientSocket = serverSocket.accept() we force the server socket to "listen" to its port and to "accept" a…
Roman
  • 124,451
  • 167
  • 349
  • 456
17
votes
5 answers

Why should I authenticate a client using a certificate?

I'm implementing a client with python's twisted that checks the server ssl certificate when connecting, following basically this recipe. I've seen in many HOWTOs such as this one the server checking the client's authenticity through a ssl…
Luiz Geron
  • 1,357
  • 15
  • 22
17
votes
3 answers

Reason for browser not showing X-Forwarded-For headers

Note: Please do read the full question I'm trying to understand as to why the browsers doesn't show me any X-Forwarded-For header every time a request a page BTW here are my Request Headers look like Request…
Ratatouille
  • 1,372
  • 5
  • 23
  • 50
16
votes
6 answers

Investigating solutions for notifying WPF clients from server

I have a project coming up with the requirement to notify WPF desktop clients when something happens on the server. Additionally, the notification to the WPF clients will not be broadcasted (sent to every client), it should be sent to specific…
Ronnie Overby
  • 45,287
  • 73
  • 267
  • 346
16
votes
2 answers

Handle a WPF Exit Event

I was wondering if there was a way to handle a WPF Application Exit event such that the exit was cancelled. The use case is that I have a client-server situation where the server is a WPF app. I want the WPF app to notify the client when it is…
sohum
  • 3,207
  • 2
  • 39
  • 63
16
votes
2 answers

Asynchronous server socket multiple clients

I have been working with the following code published on msdn: http://msdn.microsoft.com/en-us/library/fx6588te.aspx I understand that the server application is not blocked whilst the application is waiting for new clients. However can this…
Remotec
  • 10,304
  • 25
  • 105
  • 147
16
votes
0 answers

Implementing user impersonation in Rails API + React client

So, I found gems like pretender, user_impersonate2 and switch_user. They all seem to accomplish the similar goal - switching current_user for systems like Devise, for "monolith" Rails apps. I have a React client talking to a Rails app. The admin…
Oleksii Filonenko
  • 1,551
  • 1
  • 17
  • 27
16
votes
6 answers

Using POSIX message queues instead of TCP sockets - how to establish "connection"?

I have client and server programs which now communicate via TCP. I'm trying out using POSIX message queues instead (in cases where the client and server are on the same machine, of course). My hope is that it will improve performance (specifically…
John Zwinck
  • 239,568
  • 38
  • 324
  • 436
16
votes
3 answers

Send notification from server to client on server event

How can I send a message from server to client with PHP, avoiding extraneous Ajax calls. Here is the idea: User: Alice makes a change which gets sent to the server. The Server then checks to see which users are not up to date, and if not calls some…
user3765372
  • 281
  • 1
  • 3
  • 14
16
votes
4 answers

How to get server response with netty client

I want to write a netty based client. It should have method public String send(String msg); which should return response from the server or some future - doesen't matter. Also it should be multithreaded. Like this: public class Client { public…
Moses
  • 1,243
  • 3
  • 14
  • 21