-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HW4 #6
base: master
Are you sure you want to change the base?
Conversation
…ed to separate files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
5 баллов. Нужно больше тестов, в особенности таких, где читаются не текстовые, а бинарные файлы
HW04FTP/CLIENT/Network.cs
Outdated
/// <returns>Response string</returns> | ||
public string GetServerResponse(string query) | ||
{ | ||
using (var client = new TcpClient(_address, _port)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
так мы получим синхронное подключение. Нужно использовать конструктор TcpClient()
без параметров и затем использовать метод ConnectToAsync
. И лучше создавать client
в конструкторе, а не здесь. Так получается, что для обработки каждого запроса от сервера мы создаём новый клиент, а это накладные расходы
HW04FTP/CLIENT/Network.cs
Outdated
/// </summary> | ||
/// <param name="query">Raw command string</param> | ||
/// <returns>Response string</returns> | ||
public string GetServerResponse(string query) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
этот метод (как и все остальные методы клиента и сервера) должен быть асинхронным
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
хотелось бы увидеть больше тестов (чтение текстовых и бинарных файлов, и обработка некорректных запросов)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
В принципе всё хорошо, 9/10. Только проверь while (true) в файле Server/Network.cs, а то у меня сомнения насчёт него. Возможно, лучше тоже заменить его на CancellationToken. И если пишешь несколько assert'ов в одном тесте, то лучше объединить их с помощью Assert.Multiple
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
а зачем пустой класс?
public ClientNetwork(string address) | ||
{ | ||
_port = 1337; | ||
_address = address; | ||
_client = GetTcpClient(); | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public ClientNetwork(string address) | |
{ | |
_port = 1337; | |
_address = address; | |
_client = GetTcpClient(); | |
} | |
public ClientNetwork(string address) | |
{ | |
_port = 1337; | |
_address = address; | |
_client = GetTcpClient(); | |
} |
лишняя пустая строка
public ClientNetwork(int port, string address) | ||
{ | ||
_port = port; | ||
_address = address; | ||
_client = GetTcpClient(); | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public ClientNetwork(int port, string address) | |
{ | |
_port = port; | |
_address = address; | |
_client = GetTcpClient(); | |
} | |
public ClientNetwork(int port, string address) | |
{ | |
_port = port; | |
_address = address; | |
_client = GetTcpClient(); | |
} |
var givenSize = Convert.ToInt32(correctResponse.Split(' ')[0]); | ||
var realSize = correctResponse.Split(' ').Count<string>() - 1; | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
опять лишняя пустая строка
public class CommandsTests | ||
{ | ||
[TestMethod] | ||
public async Task IsGetTest() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
не очень удачное название для теста
var listener = new TcpListener(IPAddress.Any, _port); | ||
listener.Start(); | ||
|
||
while (true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
а какое условие остановки этого цикла?
Simple FTP program realisation