Skip to content

Commit

Permalink
Добавил описание на сервер запросов
Browse files Browse the repository at this point in the history
  • Loading branch information
MilkRen committed Jun 1, 2024
1 parent 44499f1 commit e17b7f3
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion LauncherDM/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<userSettings>
<LauncherDM.Properties.SettingsApp>
<setting name="Ip" serializeAs="String">
<value>185.119.58.142</value>
<value>127.0.0.1</value>
</setting>
<setting name="Port" serializeAs="String">
<value>25590</value>
Expand Down
2 changes: 1 addition & 1 deletion LauncherDM/Properties/SettingsApp.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion LauncherDM/Properties/SettingsApp.settings
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Profiles />
<Settings>
<Setting Name="Ip" Type="System.String" Scope="User">
<Value Profile="(Default)">185.119.58.142</Value>
<Value Profile="(Default)">127.0.0.1</Value>
</Setting>
<Setting Name="Port" Type="System.String" Scope="User">
<Value Profile="(Default)">25590</Value>
Expand Down
8 changes: 5 additions & 3 deletions ServerTCP/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ static void Main(string[] args)
var listener = tcpSocket.Accept(); // новый с окет для нового клиента
try
{
Console.WriteLine("Подключился!");
ConsoleExtension.WriteLineColor("Подключился!", ConsoleColor.DarkYellow);
var buffer = new byte[listener.ReceiveBufferSize]; // размер буфера . максимум сообщение из 256 байт
var size = 0; // количество реально полученных количества байт, потом чтобы оптимизировать память
do
Expand All @@ -49,9 +49,10 @@ static void Main(string[] args)

MessageHeader headerRequest = null;
byte[] headerRequestBytes;
string message = string.Empty;
bool loadToken = false;
var message = string.Empty;
var loadToken = false;
bool result;
Console.WriteLine($"Пришёл запрос: {header.Type}");
switch (header.Type)
{
case MessageHeader.MessageType.Check:
Expand Down Expand Up @@ -245,6 +246,7 @@ static void Main(string[] args)
{
listener.Shutdown(SocketShutdown.Both); // закрываем подкоючение сокета и клиента, и у сервера
listener.Close(); // отключает, закрывает сокет и освобождает ресурсы
ConsoleExtension.WriteLineColor("Отключился!", ConsoleColor.DarkYellow);
}
}
}
Expand Down

0 comments on commit e17b7f3

Please sign in to comment.