Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Give me your opinion please
Message
 
À
06/09/2005 18:34:26
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
01047123
Message ID:
01047225
Vues:
9
>>I am working on an app that connects to a device using the TCP protocol. I send a data packet (containing a command), this is a relatively small data packet. Then the device that I am connected to will return a data packet (again relatively small packet up to 1K worth of data).
>>I will connect to the device up to 250 times (send and receive data) then I will wait for about 1 minute (might be a longer wait. I think I will make the waiting period programmable from 30 seconds to 5 minutes) and do the same thing over again.
>>
>>Currently what I am doing is connecting to the IP endpoint (IP address and port) using TCP anding the command, then receiving the data then disconnecting. Then I connect, send, receive and disconnect again and so on and so forth.
>>
>>This is in my oppinion the correct way of doing this.
>>
>>The other option is to connect, then send command#1, receive, send command #2, receive, ....send command#250, receive and then disconnect
>>
>>Any thoughts on the issue? Has anyone created a class that does something similar? Which method would you choose?
>>
>>Thanks,
>>Einar
>
>I haven't worked at this "low-level", but you might consider whether TCP is more appropriate, or rather, UDP.
>
>TCP has additional overhead, because it has built-in mechanisms to ensure delivery: if a packet is not received, it will be sent again.
>
>UDP does not have this additional overhead, but you have to control yourself whether the data arrived. But it seems you are doing something similar anyway.
>
>UDP is sometimes used to transfer small amounts of data, or when quick delivery is more important than flawless data transfer - as in the case of voice over IP.

Hilmar,
Yes I had quite a few sleepless nights about 5 months ago thinking about UDP vs TCP. I am 99% sure that I want to use TCP. I have not yet tried speed testing UDP and comparing the results to TCP. My commnd data packet is usually less than 100 bytes with a maximum of about 600 bytes. The largest package I can receive is a little over 2K bytes.
I like the features TCP gives me over UDP but I don't know if all the features (and overhead) is nessesary in my application (app and device).

Do you agree that a "cycle" should be connect, send, receive and then disconnect?

Einar
Semper ubi sub ubi.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform