5/26/2011 2:18 PM | |
Joined: 1/17/2007 Last visit: 5/29/2025 Posts: 1561 Rating:
|
This thread might help you. |
Programming today is the race between software engineers building bigger and better idiot proof programs, and the universe producing bigger and better idiots. |
|
This contribution was helpful to
2 thankful Users |
5/27/2011 9:16 AM | |
Posts: 487 Rating:
|
Yes and no , more confused than ever. example ID :=1 // tcp connection number LADDR :=W#16#100 // CP module adress RECV :=P#DB64.DBX0.0 BYTE 6 // DB,DW and Length NDR :=M81.3 // New Data Recieved ERROR :=M81.4 //Error flag STATUS:=DB64.DBW252 // Status code LEN :=DB64.DBW254 // received lenght two questions 1:What happens if RECV lenght bigger than LEN ? does two messages of say 2 byte and 3 byte fille the RECV buffer up to byte 5 2 What happen when LEN bigger than RECV.? does it send the first amount and then wait for 'something and then send the second amount ? Say I send 10 byte , get the first 6 , ok then what must I do to receive the next 4 byte ? Eric |
5/27/2011 9:41 AM | |
Posts: 3093 Rating:
|
Hello Aikona, to receive telegrams with variable length with TCP native and AG_RECVproperly, it is necessary that the telegram of the communication partner includes any length information. Can you give us an example how the telegram is set up? When you call AG_RECV with e.g. length 6, the CP will wait until it has received 6 byte. These 6 bytes are transferred to the data destination. When the first telegram is 4 bytes long, the CP won't transfer any data to the CPU. It waits for the next telegram and then the 4 bytes of the first telegram and the first 2 bytes of the second telegram are transferred to the CPU. When the communication partner sends a telegram with 12 byte, you will get two data transfers CP -> CPU, each one 6 byte long (and the second will overwrite the first one). Regards, Kaulquappe I found a FAQregarding this matter. |
Last edited by: Kaulquappe at: 5/27/2011 10:21 AM |
|
Follow us on