S
S
snegirev_news2018-02-14 12:56:10
Python
snegirev_news, 2018-02-14 12:56:10

Is it possible in a client-server application on a client to connect to another client?

The crux of the matter is this. The client connects to the server and the server remembers the connected client (an object of type socket in the List). How can I organize the work and what should I transfer back from the server to the client, if I need the data to be transferred only between clients (bypassing the server)?!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Ivan Soshnikov, 2018-02-22
@soshnikov

Each client must implement the functions of the server, i.e. be able to accept and process incoming connections. The main server sends the connection data of other clients to the clients and they connect to each other directly.
Will not work if the client is behind a nat and the required ports are not forwarded.

B
bbkmzzzz, 2018-02-28
@bbkmzzzz

The client is part of a client/server application that only connects by default.
Server - only accepts connections.
In order for a client to accept connections, it must also be a server. Thus, he ceases to be a purely client and becomes a hybrid.
The scheme is something like this:
the client connects to the server, the
server transmits information about other clients and closes the connection, because it is no longer needed.
the client connects to other clients using information from the server.
architectural questions)
To all at once, by the way?
And if there are 1000 clients in the network?
on each computer on 1000 active connections for one program?
Or does the client connect as needed?
Then what about the already closed client on the other side?
It is better to use a server for general communication, and use a client-client connection for transferring large amounts of data, such as files.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question