Page 1 of 2

Winsock in eVB

PostPosted: Feb 1, 2002 @ 10:25pm
by dogpoop
I'm porting a winsock application in VB6 to eVB. However, I'm having a serious problem with winsock in eVB. I get no errors or anything-it seems to be working correctly, but it does not. I will explain:

In normal VB6, I send a login command to a server and it responds with 10 bytes of data. In the dataarrival event, it says bytestotal is 10, and len(strData) yields also 10. This works fine. The rest of the login sequence works perfectly.

In eVB, with *identical code* with the VB6 version, I send the login command and it responds just like vb6. Bytestotal is 10, but len(strData) is 4! Some -of the packet is missing! My login sequence will not complete. I cannot figure out how to make this work. I have tried everything I can think of and I am going insane. Can anyone help?

I tried that c++ dll winsock wrapper called cesockets or whatever, and with similar results as normal eVB. It returns 10 bytestotal but len(strData) returns 5. What the heck is going on?

It's imperative that I get this working. I don't have access to the server source so I cannot modify this. I will reiterate: the code in eVB and VB6 is now identical. It works in VB6 and not eVB. C++ DLL doesnt work either so please no "vb sucks" flames.

Has anyone experienced similar problems? Workarounds? or I would like even any sort of info on the eVB winsock control, or links to other c++ wrappers. I really need to get this to work and I can't see a solution.

Can you help me?

Thanks,
Dogpoop on a soda can.

PostPosted: Feb 1, 2002 @ 10:34pm
by Dan East
VB isn't my thing at all (never touch the stuff), but UNICODE may be an issue. The eVB strings should be unicode, so if you are reading 10 ascii chars into a unicode string there may be problems.

Dan East

arg

PostPosted: Feb 1, 2002 @ 10:35pm
by dogpoop
Of course, minutes after I post, I find out the reason. For those that are curious:

It is a known MS bug that the windows ce winsock control (and I think the winsock.dll also) will have problems receiving binary data. It may not receive all of it; it stops at the first ascii value of 0. This was my problem.

Even though I know what my problem is, I still need to fix it. I am wondering, is it possible to receive it as a byte array and then put it back together as a string?

Winsock in eVB

PostPosted: Feb 1, 2002 @ 10:37pm
by Pam

PostPosted: Feb 1, 2002 @ 10:38pm
by Pam

PostPosted: Feb 1, 2002 @ 11:43pm
by dogpoop

PostPosted: Feb 1, 2002 @ 11:50pm
by RwGast

PostPosted: Feb 2, 2002 @ 12:09am
by dogpoop

PostPosted: Feb 2, 2002 @ 12:09am
by Dan East

PostPosted: Feb 2, 2002 @ 12:23am
by dogpoop

PostPosted: Feb 2, 2002 @ 12:31am
by Dan East

PostPosted: Feb 2, 2002 @ 1:11am
by RwGast
Dan that isnt the probelm ;) vb does auto formating of its strings no need for a null terminator. MS has admited there control is shit. The guy ran benchmarks and it took 512ms to send his data using the vb control his C dll took 2ms or something. The control looses data sending and reciving its full of alot of bugs :(. I would recommend this person write his own winsock functions in C using winsock.h or get the dll file i mentioned at www.devbuzz.com, if you search that site for winsock youll find the article im reffering too it is very intresting.

PostPosted: Feb 2, 2002 @ 6:32am
by Guest
yep rwgast, I did read the article and got the cesockets.dll from it. I need to receive in binary mode though as it is still plagued by the "binary bug". AFAICT (as far as I can tell) it only sends strings. I tried to do what Dan said by splitting it into a byte array but I was getting errors and so I gave up for the evening :) I will have a fresh look at it tomorrow but things don't look to good :( You would think MS would have caught these completely obvious bugs before they released it. Anyone know when the next eVB (or winsock control) is coming out? ;)

BTW thanks for all your help and insight guys...I am confident I can do this eventually, Im just not sure how.

PostPosted: Feb 2, 2002 @ 8:30am
by RwGast
You would think wouldnt you. I was pretty disapointed with vb's winsock support you try using strait winsock api in vb yet?

PostPosted: Feb 2, 2002 @ 7:30pm
by dogpoop