forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


TCP - Binary Data

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
DavidR
Contributor
Contributor


Joined: 05 Aug 2003
Posts: 83
Location: Bethel Pennsylvania U.S.A.

PostPosted: Tue Apr 08, 2008 3:29 pm    Post subject: TCP - Binary Data Reply with quote

I'm really struggling with what I think should be a simple application.
I need to be able to send a string of data to a device in response to a query from the device. I can use either serial or TCP.
I've tried the COMM function in VDS 6 but it can only handle text.
I love VDSIPP and use it extensively but have not been able to figure out how to detect incoming data unless it's terminated by a line feed.
Sending the data response has not been a problem. Detecting the incoming data has so far been impossible.
For example the device might send 23 FF (hex) to which I need to respond with F8 00 FF.
Is there a reasonable way to do this that I might be overlooking?

Thanks.....
...........David
Back to top
View user's profile Send private message
PGWARE
Web Host


Joined: 29 Dec 2001
Posts: 1566

PostPosted: Wed Apr 09, 2008 7:20 am    Post subject: Reply with quote

Unfortunately it probably won't be possible with the vdsipp.

Using the INTERNET, TCP SIMPLESEND command will let you send data without a linefeed but there is no way to get data back without a line feed.

The @internet(tcp, message) function will not return any data as it will only return data once a line feed has been processed. The reason I wrote it like this is because without a linefeed I would have had to generate an event on each character sent (while possible would have made using the extension much harder to understand/use).

I believe Tommy Sools had a internet extension as well which may handle data without a linefeed.
Back to top
View user's profile Send private message
Aslan
Valued Contributor
Valued Contributor


Joined: 31 May 2001
Posts: 589
Location: Memphis, TN USA

PostPosted: Thu Apr 10, 2008 12:31 pm    Post subject: Reply with quote

DavidR wrote:
I can use either serial or TCP.



Will this help?

It's from Tommy's VDSDLL pack


Quote:
VDSSERIO

Description:

With this VDSDLL part, you can control a serial port. You’ll retrieve buffered input from the serial port and transmit data towards a device connected to it.

Commands:

DLL SERIAL, PORT, <communication port number>

Specifies the communication port that’s to be used by the DLL, starting from 1.



DLL SERIAL, BAUDRATE, <baudrate>

Specifies the baud rate used for communications. This usually differs for each device.

<baudrate> could be one of:

110

300

600

1200

2400

4800

9600

14400

19200

38400

56000

57600

115200

128000

256000



DLL SERIAL, STOPBITS, <number of stopbits>

Specifies the number of stop bits to be used. This usually differs for each device.

<number of stopbits> could be one of:

1

1.5

2



DLL SERIAL, BYTESIZE, <bits per byte>

Specifies the number of bits contained in each byte. This usually differs for each device, although it’s often 8.

<bits per byte> could be one of:

4

5

6

7

8



DLL SERIAL, PARITY{, <parity checking>}

Specifies the kind of parity checking that’s performed, if any. This usually differs for each device, although it often isn’t disabled.

<parity checking> could be one of:

even

mark

odd

space



DLL SERIAL, OPEN

Opens the communication port with the specified settings.



DLL SERIAL, SEND, <encoded binary string>

Sends the specified data to the serial port. Even if the selected byte size is different from 8, you can treat the bytes as sized 8.

<encoded binary string> must be according to the following:

<two digits hexadecimal ASCII value of character 1><two digits hexadecimal ASCII value of character 2><two digits hexadecimal ASCII value of character n>

For example, the following could be provided in this case:

FF150088FB10



DLL SERIAL, CLOSE

Closes the communications port again after it’s opened. You should always do this before your script is closed, in case the port is opened anywhere in your script. It cannot be closed automatically. If you don’t do this, the memory used by the component cannot be freed up (no attempt to do this would be made either) and the script will either crash or leak memory. It’s advisable to use OPTION ERRORTRAP to close the port on exit of your script, even if any error occurs.

Functions:

@DLL(SERIAL, VERSION)

Returns the part’s version number.



@DLL(SERIAL, RECEIVE)

Receives any input from the serial port. Even if the selected byte size is different from 8, you can treat the bytes as sized 8.

The result will be according to the following:

<two digits hexadecimal ASCII value of character 1><two digits hexadecimal ASCII value of character 2><two digits hexadecimal ASCII value of character n>

For example, the following could be returned in this case:

FF150088FB10

Events:

SERIALRECEIVED – new data arrived on the serial port

SERIALSENT – the data in the data buffer has successfully been transmitted. Please do not depend on this event as it is only generated very rarely.

Errorcodes:

1201 – any error occurred in the communications

Back to top
View user's profile Send private message Send e-mail
DavidR
Contributor
Contributor


Joined: 05 Aug 2003
Posts: 83
Location: Bethel Pennsylvania U.S.A.

PostPosted: Thu Apr 10, 2008 1:45 pm    Post subject: Reply with quote

Yes, that looks like it will do exactly what I want.

I placed an order for the DLL and as soon as I get the registration code I'll get started.
Thanks....
.............David
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group