|
|
|
TCP UDP
|
|||
|---|---|---|---|
|
#18+
Hello. I actually have more than one question and I don't know whether I should post separate topics or write all in one, so since they all are about implementing a server I'll keep it simple - all here. Brief info first, the server should deal with both TCP and UDP protocols: TCP for transferring large amounts of data, files and pre-loading caching, UDP for game-state-updates and small in-game information chunks which are critical on delivery speed and size. It should run on Windows/Winsock. The first question is: what's a better idea - to have one program running which deals with both UDP and TCP parts or to keep them separate? The second question is about the TCP server: it should support multiple [>1000] connections at once. What's the best way to organize the connections part - using Windows asynchronous sockets or 1-thread-per-connection style or anything else I may not be informed about? Thanks a lot for help.. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 21.03.2004, 17:42 |
|
||
|
TCP UDP
|
|||
|---|---|---|---|
|
#18+
1. Why not. TCP encapsulates the some complexity related to reliability, UDP, as it's known, has much smaller time of the response. if the using of the 2 IP ports is not a problem - use them simultaneously 2. use the asynchronous sockets with thread pool for request proccesing, don't forget to specify the enough queue length ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 21.03.2004, 18:34 |
|
||
|
TCP UDP
|
|||
|---|---|---|---|
|
#18+
vdimas2. use the asynchronous sockets with thread pool for request proccesing, don't forget to specify the enough queue length Some corrections... The number of threads in pool must be approximatly equal to number of computer processors in other case you will spend a lot of time for context switching between different threads. See for examle J. Richter book "Programming server-side applications for Windows 2000". As I know (from this book, not from practice) the best solution is using of Input-Output completion port. See help for CreateIoCompletionPort function. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 24.03.2004, 11:13 |
|
||
|
|

start [/forum/topic.php?fid=57&msg=32454401&tid=2035248]: |
0ms |
get settings: |
8ms |
get forum list: |
19ms |
check forum access: |
3ms |
check topic access: |
3ms |
track hit: |
48ms |
get topic data: |
8ms |
get forum data: |
2ms |
get page messages: |
38ms |
get tp. blocked users: |
1ms |
| others: | 197ms |
| total: | 327ms |

| 0 / 0 |
