Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Trying to make a TCP/IP connection work

Author
Message
ZachR
21
Years of Service
User Offline
Joined: 16th Mar 2003
Location:
Posted: 16th Mar 2003 10:59
I'm new to DBpro, but have quite a bit of experience programming C++ and VB. I'd like to have my DB program connect to a server that I wrote using c++, but I am having a little trouble. The server is set up to send out a string (ending in a \n) about 10 times a second. I know the server is working correctly, because I can easily connect to it using a few lines of VB code and get the results I'm looking for. Here's what I've tried in DB:

sync on
rem Using Ariel Benzakein's network dll
load dll "network.dll",1
FileHandle = call dll(1,"OpenTCPPort",10001,"localhost",2000)
for count=1 to 5
sync
response$ = call dll(1,"TCPLineInput",FileHandle)
print "tcp data="+response$
wait 100
next count
delete dll 1

I start my server. Then run this code. I get this as a result:

tcp data=This is a test message
tcp data=
tcp data=
tcp data=
tcp data=

I should be seeing the test message from my server on every line. I have played with the wait time and the number of times the for/next repeats. However, all I get is data on the first line. Any suggestions?

In VB I use the event tcpClient_DataArrival. Is there anything like this in DB?

Thanks,

Zach
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 16th Mar 2003 19:42
"Any suggestions?"
Yep. This looks like it may be a problem with the DLL rather than DB. If you can post your DLL code (or email it if you prefer) along with the server executable I can have a look at it for you.

"In VB I use the event tcpClient_DataArrival. Is there anything like this in DB?"
Nope. DB is not event driven. It's a procedural layer on top of the windows event driven model.
ZachR
21
Years of Service
User Offline
Joined: 16th Mar 2003
Location:
Posted: 16th Mar 2003 21:06
Thanks for the reply Ian.

I didn't write the network DLL, I found it at:
http://www.vertextechnology.com/products3.html

I am open to using another DLL or method of TCP/IP com if one is available.

Here's a link to the server source:
http://www.buildcoolstuff.com/images/testserver.zip


Thanks in advanced,

Zach

IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 17th Mar 2003 20:07
The problem was primarily with your server code. If you want to email me (using the email link/button) then I will send the server app back to you.

Login to post a reply

Server time is: 2024-11-24 05:28:39
Your offset time is: 2024-11-24 05:28:39