c# - I can't read data from the client -


for educational purposes, writing program passes through sql queries. should work this:

enter image description here

but receive not return data.

private static byte[] readtoend(socket mysocket) {   byte[] b = new byte[mysocket.receivebuffersize];   int len = 0;   using (memorystream m = new memorystream())   {       while (mysocket.poll(1000000, selectmode.selectread) &&                 (len = mysocket.receive(b, mysocket.receivebuffersize, socketflags.none)) > 0)       {           m.write(b, 0, len);           console.writeline("Я тут");       }       console.writeline("и тут");       return m.toarray();     } } static void main(string[] args) {     tcplistener mytcp = new tcplistener(new ipendpoint(ipaddress.parse("127.0.0.1"), 8888));     console.writeline("Прослушиваю порт");     while (true)     {            mytcp.start(); // Запускаю процесс прослушивания         if (mytcp.pending()) // Если есть запрос         {             console.writeline("Соединение добавлено в очередь");             using (socket myclient = mytcp.acceptsocket()) // То создаю сокет для этого запроса             {                 if (myclient.connected) // Если сокет открыт, то считываю поток байтов от клиента                 {                          console.writeline("Открываю сокет для считывания запроса");                         byte[] sqlquery = new byte[myclient.receivebuffersize];                         sqlquery = readtoend(myclient);                     }             }         }     } } 


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -