Client connects, but server is not receiving messages

Mar 28, 2013 at 11:31 PM
I've got a supersocket server setup and am trying to sent messages with both a TCPClient and AsyncTcpSession from SuperSocket Clientengine. I can connect fine, but it seems like the server is not receiving any data.
                session.Send(GetBytes(msg), 0, GetBytes(msg).Length);

// client.Client.Send(GetBytes(msg), 0, GetBytes(msg).Length, SocketFlags.None);

                NetworkStream clientStream = client.GetStream();

                ASCIIEncoding encoder = new ASCIIEncoding();
                byte[] buffer = encoder.GetBytes("Hello Server!");

                clientStream.Write(buffer, 0, buffer.Length);

 public byte[] GetBytes(string str)
            byte[] bytes = new byte[str.Length * sizeof(char)];
            System.Buffer.BlockCopy(str.ToCharArray(), 0, bytes, 0, bytes.Length);
            return bytes;
(Excuse me for the horrible formatting, cannot seem to get it right)

Sending messages by telnet in a command prompt works fine.
Mar 29, 2013 at 2:46 AM
Please read the documentation of SuperSocket at first.
Mar 29, 2013 at 8:29 PM
I did, that's where I got the telnet test from. But the documentation only covers the server, and not the appropriate way to send data clientside.
Mar 31, 2013 at 4:31 PM
Edited Mar 31, 2013 at 5:24 PM
Alright, I'm one step further. Appsessions's "IAppSession.ProcessRequest()" method is being triggered whent the client is sending data. The nested method "FilterRequest()' always seems to return null though. Specifically it goes into "var requestInfo = m_ReceiveFilter.Filter(readBuffer, offset, length, toBeCopied, out rest);' at line 529 which then returns -1 at "int result = readBuffer.SearchMark(offset, length, m_SearchState);" which causes the null return.

I also noticed that the offset is pretty huge; 405504 , while the length is only 4. (I passed in 0 as offset in the client)

My knowledge of sockets isn't very good (which is why I came to supersocket!) so I don't really have an understanding why this is happening.

I've also tried to enable logging for better debugging purposes. I've followed but cannot fire "LogUtil.Setup()" since the LogUtil namespace is not found in my project.

Thanks in advance !
Mar 31, 2013 at 5:36 PM
Please read this document carefully:

If you can verify the server by telnet, but your client failed.

Please ensure your client send same format message with the telnet client to the server.

Each request of telnet protocol must end with ā€œ\r\nā€.

In telnet client, you type "ECHO xxxxx" and then ENTER, in the same case, your client should send "ECHO xxxx\r\n" to the server, because ENTER means "\r\n".
Mar 31, 2013 at 7:21 PM
I feel like a fool right now, the "\r\n" totally did the trick. I think the simplicity of the telnet test confused me.
For any future readers, the GetBytes method in my code is not correct. This is the correct way to convert a string into bytes.
System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
Byte[] bytes = encoding.GetBytes(msg);
Thanks a bunch !