Reply from emp1953 on May 23 at 10:44 AM John Warner, I'm revisiting this problem again, I was pulled away from it last November and am now just getting back to it. By changing to snd_string(256) as byte, a number of other changes need to be made in the code to accomodate this. I populate the former string variable as follows: fbm.snd_string = textBox1.text How do I populate the byte array with the contents of textBox1? Thanks Ed
| | | ---------------Original Message--------------- From: edgar purdy Sent: Saturday, November 05, 2011 11:40 AM Subject: How to Send/Receive Strings Over Socket in VB6 I have a VB6 app that exchanges messages with a VS8 c++ app that is written in very C-like code. No classes, streams, etc. The c struct looks like this: unsigned short msgid; unsigned short msgsize; unsigned char snd_string(256); The UDT struct on the VB side looks like this private Type feedback_msg_struct msgId as integer msgSize as integer snd_string as string end type Dim fbm as feedback_msg_struct Dim bigBuffer() As Byte In my dataArrival routine I have the following: tcpClient.GetData bigBuffer, vbByte + vbArray, msgsize CopyMemory fbm, bigBuffer(0), msgsize The string part of fbm does not populate. Looking at bigBuffer() in the debugger the msgId and msgSize are there and it appears that there is ascii hex code in each byte of bigBuffer(0). Also, the length of the structure fbm is very small if I do a Len(fbm), much small than the size of the message received on the socket. How do I get the string part of the message received into my VB app? Then I have to populate and send a similar struct back to the VS8 app. | | Reply to this email to post your response. __.____._ | _.____.__ |
No comments:
Post a Comment