powered by simpleCommunicator - 2.0.61     © 2026 Programmizd 02
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Форумы / C++ [игнор отключен] [закрыт для гостей] / TCP UDP
3 сообщений из 3, страница 1 из 1
TCP UDP
    #32450559
ALFA Soft
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
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..
...
Рейтинг: 0 / 0
TCP UDP
    #32450581
Фотография vdimas
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
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
...
Рейтинг: 0 / 0
TCP UDP
    #32454401
_Konst
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
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.
...
Рейтинг: 0 / 0
3 сообщений из 3, страница 1 из 1
Форумы / C++ [игнор отключен] [закрыт для гостей] / TCP UDP
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]