| |

VerySource

 Forgot password?
 Register
Search
View: 1162|Reply: 9

The strange problem of ServerSocket and ClientSocket

[Copy link]

1

Threads

5

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-11-4 10:30:02
| Show all posts |Read mode
In the local area network, there are currently three clients (for development and testing) at most nine, long connection, large amount of data, fixed packet structure but variable length, D7+SERVERSOCKET and CLIENTSOCKET server and client are asynchronous.

Process: The client may generate data at any time. After the data is generated, it is uploaded to the server, and the server parses and writes the library after receiving it (the maximum time is no more than 1 second). Then issue a processing completion notification. The client continues to upload after receiving it.

The problem now is that after running for a period of time (one to two hours, or maybe three hours), there will be problems, or the service cannot receive the data uploaded by the client, or the client cannot receive the processing of the server. Complete notification. Do not know what's going on?
Reply

Use magic Report

2

Threads

4

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-11-4 19:00:01
| Show all posts
Is it not connected? Use netstat -an to check the connection status on the command line
Reply

Use magic Report

0

Threads

8

Posts

9.00

Credits

Newbie

Rank: 1

Credits
9.00

 China

Post time: 2020-11-4 19:15:01
| Show all posts
Usually use Indy's~
Reply

Use magic Report

0

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-11-4 19:30:02
| Show all posts
Long connection is not keeping the connection. You should close the connection after transmitting a set of data and re-establish the connection with the new data. This situation is unavoidable.
Reply

Use magic Report

1

Threads

5

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

 Author| Post time: 2020-11-4 19:45:01
| Show all posts
There should be no problem with the connection, because after a problem, if it cannot be received, it can be sent. If it cannot be sent, it can be received. This should indicate that the connection is not broken
I don’t want to change INDY now, I just want to know what’s going on
It’s not feasible to close this after the data has been transmitted. My system is real-time. There may be data at any time, which will cause continuous connection closures.
Reply

Use magic Report

0

Threads

9

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

Post time: 2020-11-4 20:00:01
| Show all posts
It seems that this kind of situation is prone to occur when socket is not communicating for a long time. You can use a timer. When there is no interaction for a long time, send a non-existent information data to each other every 10 minutes. Try
Reply

Use magic Report

1

Threads

5

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

 Author| Post time: 2020-11-4 20:30:01
| Show all posts
Dizzy, it’s not that there is no interaction for a long time, but it’s been interacting all the time, and data is always being transmitted
During normal transmission, it suddenly becomes abnormal. . .
Reply

Use magic Report

0

Threads

12

Posts

12.00

Credits

Newbie

Rank: 1

Credits
12.00

 China

Post time: 2020-11-4 20:45:01
| Show all posts
attention!
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-11-4 21:15:01
| Show all posts
I also have this problem here. There are about 5-7 clients that are quite fast at the beginning. It took 3-4 hours and then slowed down. And the memory gradually increased, reaching 900M, and finally died!
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-11-4 22:45:01
| Show all posts
It is estimated that there is an error on the server side, the server side is congested, and the data reaches the TCP cache of Windows, but the upper layer data is not processed. It may be that on the server side, you are not using event-driven programming, but actively receiving data. When the client sends data congestion, the subsequent data is incorrectly processed, causing the server to wait for a long time when analyzing the data according to the structure, causing further data congestion.
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list