Recieve command not returning anything

msufreeman

Member
Joined
Jun 15, 2007
Messages
8
Programming Experience
1-3
Hello, I am working on an API and using sockets. All of my functions are working properly but I am stuck on one and can't figure it out.

In this funciton, I am building a string and using the following command to send the string as the interface code:

VB.NET:
Dim buff As Byte() = System.Text.Encoding.ASCII.GetBytes(stringToSend)
Dim buff2 As Byte() = New Byte(3000) {}

Dim m_asynResult As IAsyncResult

m_asynResult = SConnection.BeginSend(buff, 0, buff.Length, SocketFlags.None, Nothing, Nothing)

System.Threading.Thread.Sleep(300)

m_asynResult = SConnection.BeginReceive(buff2, 0, buff2.Length, SocketFlags.None, Nothing, Nothing)

Return enc.GetString(buff2)


Stepping through the code, I get to where it sends the command and using and add watch I see the actual command that it is sending. I have copied this command and pasted it into a telnet session and the command works perfectly.

For some reason though when it does the recieve it gets nothing back.

I have tried adjusting my buffer sizes and sleep time, but to no avail. I am completely stumped. Any help would be much appreciated.

Thanks
 
Last edited by a moderator:
Well I solved it... and feel like quite an idiot heh:)

The problem was that I forgot to add & vbCrLf after my string before I sent it...

I'll definately make sure I check for that problem from now on!
 
Back
Top