Click here to Skip to main content
15,882,152 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all!
I have create a model server/client (TCP/IP, Socket) through LAN.
So, Server is developed by MFC application
Client by VB.Net
It's is connect, wait,send,revice and end , that's OK
so, data send and revice is error.
at client, message show memory is throw, data send OK but server not is read them.
I think it is error by variable unsigned char* in C++ (packet type server) with
byte() in VB.Net(packet type client)
So, i don't know, how to fix it.
Can help me a good solution, idea.
Thanks so much!
Posted

1 solution

allocate a byte buffer in VB an let C++ fill the bytes. Use the length as parameter to avoid buffer overruns.

i wolud write code like that:

in vb.net

VB
Dim buffer(200) as Byte
Call_C_Plus_Plus(buffer,200)


in c++

C++
int Call_C_Plus_Plus(char *buffer. in len)
{
 strncpy( buffer, my_c_message, 200);
}
 
Share this answer
 
v2
Comments
dev C plus 1-Aug-13 4:24am    
yes, i have do it! So, result is same old time!
Client : redim packetRev (lenghtPacket-1)
Server : unsign long ulSize
KarstenK 1-Aug-13 4:38am    
i didnt understand your message. So I added some sample code.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900