examples of protocols using UDP initially followed by TCP - lua

Hey SO,
What examples do you know - of protocols initially "handshaking" in UDP, then "conversing" in TCP.
I know there are heaps, I just can't seem to think of any right now.
Specifically, I'm trying to write a Wireshark dissector - for this kind of protocol.
So being able to peek on a similar dissector, seems like a good start.
Would love to hear if you've ever written a stateful Wireshark dissector in LUA.

One example is SIP/Fax.
SIP/SDP setups the session for fax transmission, and then transfers fax/image via TCP/TPKT.

There are several that use both UDP and TCP (see Apple's list, marked as TCP/UDP), but I don't know if they behave exactly as you've described (initial handshake with UDP). DNS and NFS are a couple examples.
I've written Wireshark dissectors in Lua, but not stateful ones.

Surely a handshake would be in TCP being a stateful connection? A handshake seems like something that would want to be ordered, compared to UDP where there is stateless transmission?

I've added some kind of statefulness for the HTTP protocol within my project aimed to lookup original HTTP request for given HTTP response.
Generally speaking, Lua has nice notion of closures which can be used as kind of static global variables for holding handshakes and whatever other references.

Related

What does protocols mean in a computer system

We know that a protocol is a rule that computers follow so that they can effectively communicate with each other.
But when we talk about rules, the question arises, what are these rules.?
For example, let's take the http protocol. What rules does it have on which computer follows?
I will now list some of the rules, and if it’s wrong, please correct me and tell me whether they are rules in general or not.
For example http protocol ...
this protocol dictates such rules ..
1.determines on which method (GET, POST and then) the request will be sent.
2. on which host the request will be sent.
3. what format will be requested file.
4.which data cookie will be sent to the server
5. on which port the request will be sent
etc....
when we talk about TCP protocol ...
this protocol dictates such rules ..
1.It records on which port the data will be sent.
2.data is divided into packets and a number is assigned to each packet so that the computer that receives the data will correctly arrange the packets.
3. When a packet is lost on the road, it has rules to send the request again to get the lost packet.
etc....
when we talk about the IP protocol ...
this protocol dictates such rules ..
1.This protocol provides source and destination ip addresses and decides on which routers packets should go. routers work at this level.
etc....
Please confirm if I understand correctly, do these rules represent a protocols or not??
Communication protocols need to define everything needed for two separate software developers to write two separate pieces of software that are able to communicate to each other using that protocol.
This includes things like the context in which the protocol is expected to operate, the various protocol states (e.g. the TCP state machine), the expected behavior in each state, how transitions between the states work, how messages are encoded, and what is the precise meaning of each message is.
Your examples are on the right track, but I suggest you skim at lest some of the initial RFCs for the protocol you mentioned like IP and TCP. They're fairly readable and will give you a better idea of what's need to define a protocol.

F5 OneConnect with non-HTTP traffic

Is it possible to use F5 OneConnect with non-http traffic? It seems like it might be possible to create iRules that can figure out when to attach/detach, but I haven't seen any examples.
Yes, its possible.
As per F5 AskF5 SOL7208:
The OneConnect profile may be used with any TCP protocol,
but will function only when applied to virtual servers that
are processing simple request/response protocols where
transaction boundaries are explicitly obvious, such as those
in which each request and each response is contained within
a single packet.
So it would still depend on the protocol that you want to load-balance. What protocol are you going to load balance?

Detect unreachable ports for UDP in Erlang

I am looking for a way to detect "port unreachable" errors for outgoing UDP packets in Erlang, so I can eagerly report transport layer errors to the application. I.e, I want to capture ICMP type 3 packets to report to the higher layers that packet have not reached the destination.
Currently I know about two approaches:
Use undocumented gen_udp:connect/3. However, it seems like this requires opening a new socket for every new destination pair address:port. The advantage is that this does not require any privileges.
Use gen_icmp which requires either setuid helper or capabilities to open raw sockets.
Are there any other variants I am missing?
procket might be what you're looking for, but I've never used it myself. It's a binding to the low-level socket API, therefore it allows you to use all the protocols the underlying API supports. I'm just quoting its README, so please take it with a pinch of salt.

How To send Array or vector (has contact list ) from IdTCPServer to IdTCPClient (indy10)

1)
Now I am writing IM chat System i face some problem how to send vector that has information from the server to Client
2)
is any way to communicate between tow client ??
I Use CBC2010 - Indy10
Basically communicating over TCP is about sending bytes from client to server, and receiving bytes on the client from the server.
You either can give meaning to those bytes, or have something wrap that for you.
There are many possibilities and protocols to choose from.
On the foundation, you have either UDP (which is unreliable, but incurs almost no overhead, but very well suited for broadcasts) and TCP (which is more reliable, therefore has more overhead, but is easier to use).
A transport protocol that is often used on top of TCP is HTTP, especially since it is easy to get it through proxy servers.
On top of that you can do XML+SOAP or JSON+REST, which make translating from/to your underlying objects a lot easier.
All in all there are a truckload of options to choose from.
A simple start is the Delphi chat example at delphi.about.com. That definitely should get you going.

What are the ways of interchanging string data between clients and a server in Delphi?

I have a server and some clients (about 50) in an intranet. The clients send short (about 40 character) string data to the server and the server answers with a similar string. There are up to (but not permanently) 2-3 requests per second for each client. The server has to serialize the requests to get the response strings.
The system should have as less as possible impact on the network as possible (i.e. the server may run something like a webserver already). It should be as easy to install and administer as possible.
What are the possibilities to achieve this using Delphi (Client: D7, Server up to D2010)?
I use the Synapse library for such a simple server. Its lightning fast, very light, and threads easily. The demo Echo in the main synapse install is a fantastic start for what your trying to do. If you are going to be performing database access inside each request/response thread then I strongly also suggest looking at the connection pool example by Cary Jensen to keep your database connections in check.
TCP, definitely. But I'd like to give a vote for ICS. Never liked Indy ...
What about Indy's TIdTCPServer and TIdTCPClient? They provide command handlers, which makes implementing text-based protocols very straight-forward.
There are a lot of options.
Ultimately, I agree with Smasher and like using sockets. They're quick, easy and portable. If you're dealing with a fairly simple protocol and don't need a full n-tier solution, creating a TCP or HTTP server application is dead simple, very light weight, and easy to make compatible with any client. You can even add SSL support to these stand alone applications without having to configure a web server or interfering with it, if it's already running on the same box.
I use RemObjects SDK for this sort of purpose. It takes care of all the difficult stuff, and I just ask it to connect and make function calls to pass the data.

Resources