Send/receive string with UDP

Begonnen von bartmarchand, 21. April 2019, 15:47:29

Vorheriges Thema - Nächstes Thema

0 Mitglieder und 2 Gäste betrachten dieses Thema.

bartmarchand

Hi there,

I'm trying to send this string: '20 00 00 00 16 02 62 3A D5 ED A3 01 AE 08 2D 46 61 41 A7 F6 DC AF D3 E6 00 00 1E' of hexadecimal values over UDP to an IP address.
I should receive this answer: '28 00 00 00 11 00 02 98 D8 63 35 D2 EA F6 C3 DC 00 01 7B 02 00' for further analysis.

I think I could use the http demo example for this, however, I do not understand the url_text syntax for this.
Can you point me in the right direction?

peewit

This has nothing to do with http.

http uses tcp connections

you simply have to parameterize a udp connection with ip_control and then write the byte data into the send buffer and enter the data length and send it

bartmarchand

Hi peewit,
thank you for the quick response, as usual.

It's too hard for me to understand this udp transfer, it's too long ago that I was in this kind of programming, my fault...
Is it possible to give me an example on how it's done?

bartmarchand

OK, a small succes for now.

With the fb IP_Control, it is possible for me to sent a string to a predefined IP address.
I'm starting the transfert by setting IP_C.C_ENABLE to TRUE.

For testing, I sent an UDP string to my pc, where an app "UDP Client Server" is running.

However, as long as C_ENABLE is TRUE the same string is transfered again and again.
How can it be adapted so that the transfer stops after 1 transfer?

peewit

as soon as a data length is entered in S_BUF.SIZE, the data is sent and then automatically set to 0 by the IP_Control module.

you probably write every cycle the data length in S_BUF.SIZE

therefore the data is sent again and again