to support iptv directly on udp/tcp - udp

I used to suport live555 client on android. it was supposed use rtp over udp/tcp. now I was asked to run it directly on udp/tcp in single program. Frankly, without rtcp/rtp, how could udp frames be reordered?

You would need to develop your own protocol. I'd suggest looking at how TFTP is implemented. Keep in mind however that with UDP datagrams, there are no guarantees; you will be responsible for ensuring out of order data is discarded and that lost/undelivered datagrams are handled/tolerated by your protocol.

Related

Creating a Customized MODBUS Program for a Remote Terminal Unit

I have here a unit of King Pigeon S275 Remote Terminal Unit..
this RTU has communication modules for GSM, GPRS and TCP/IP (via RJ45 connection)
I can also communicate with this RTU by connecting it to my computer via USB .
The Manual I uploaded in this link...
https://www.mediafire.com/?gnfzfz5l7pess1p
This RTU can be configured using a configurator Software that is included in the purchase. By using that configurator software, you can also see the data/readings of all sensors connected to it, you can also see the status of all Digital Input/contacts connected to the RTU...
I have been researching about MODBUS the past days and I would like to create my own MODBUS program so that the S275 RTU can also send the sensors' data, or all the I/O data to my own program....
However ... I still do not know where I can start ...
Can I make this Modbus Program
1. using VB?
2. using PHP?
What other parameters do I need to know ?
and tutorials for making this modbus software...
I also uploaded here the S275's;
1. GPRS Custom Protocol
2. MODBUS TCP Handshake Communication Protocol
3. Register Address
https://www.mediafire.com/?khnfu53a4p12nrd
Thanks
PHP and ModBus sounds challenging. You want to control a serial port via PHP.
The easiest way is to get/purchase a library for ModBus/RTU.
Otherwise you have to implement the whole protocol by yourself from http://www.modbus.org/specs.php
You can use nmodbus API to add how reference in your VB or C# project.
There you have the manual.
Supports serial ASCII, serial RTU, serial over USB ASCII, serial over USB RTU, TCP, and UDP protocols.
These kinds of RTU’s are pretty inexpensive which means your greatest cost will be the time you will spend developing and debugging a driver. With that in mind I would first check if the RTU comes with its own OPC Server. Implementing an OPC client in C# or vb.net is very straight forward with plenty of code example out there. Some examples can be found here:
https://opcfoundation.org/developer-tools/developer-kits-unified-architecture/-net-stack-and-sample-applications/
If the RTU does not come with its own OPC server then, you can purchase a Modbus OPC Server from $900 to $2000 which will still be much more cost effective than writing and debugging your own driver and tends to be easier to setup. It will also significantly reduce the time to deliver your solution to your end customer which will be important if keep to project schedule is critical. I would check out, https://www.kepware.com/ and http://www.matrikonopc.com/
The other advantage of OPC is that it is a standardized interface which means should the RTU be replaced with a different model that supports a different protocol you would only have to purchase a new OPC server without the need to update your source code.
If the RTU does not have an OPC server or spending up to $2000 also not an option then there is plenty of open source implementations of the Modbus protocol, however implementation tends to be a bit more complex.
No problem, I used PHPModBus in several projects and it works like a charm!
This library supports Modbus TCP and UDP.
Try it, it is quite easy and straightforward.

File Transfer Using Pjsip

I want to develop a program in c using pjsip for peer to peer file transfer. As pjsip uses ice and in ICE UDP is used, so do I need to handle the packet delivery assurance.
And as I would be sending the file by breaking it into several parts and them re assemble all the parts at the receiver's end, so do I have to maintain the sequence of the packets or can i assume that packets are delivered in the correct sequence??
With UDP you can neither assume that packets are delivered in order nor that they are delivered exactly once nor that they are delivered at all! So you need to come up with a protocol that does a lot of things which normally TCP would take care of. It has to reassemble the original data stream and handle the things I listed above.
Additionally, with UDP you can have the problem that you cause congestion. TCP can avoid that with its congestion avoidance algorithms, with UDP you can easily send packets too fast causing them to drop at the overloaded router.
All these are non trivial problems to solve so I suggest you read up on the topic. I'd start with a good book about TCP.

Using WinPCap for UDP receiving

I would like to use WinPCap library for "reliable" UDP receiving in my C++ application. All examples that I found, using this library for capturing and then proceding. Is there any way (example) how to configure PCap for streaming mode and receive UDP only and on uder defined port or how to solve this. In this time I have reliable UDP server able to receiving 0.5Gb/s. But on slower PC I have a packet lose I can see packets in ethereal but not in application.
thanks
vsm
I assume that you have already tried all of the more standard methods of increasing the number of datagrams that you are able to process? Things like increasing the recv buffer size, speeding up the processing that you do per datagram and using IOCP to allow you to bring more threads to bear on the problem or using RIO if you can target Windows 8?
If so then using WinPCap might work but it sounds like a bit of an extreme solution.
What you need to do is create a filter so that you only capture the datagrams that you are interested in... The docs include examples which use filters.
I have server from here: http://www.gamedev.net/topic/533159-article-using-udp-with-iocp/. This code working with IOCP. Its working fine on WIndows XP. There is no problem with receiving 0.5Gb/s. But now on Win7 is little unreliable. Sometimes there are packets positions error. (my device generating udp packets and in its payload there is PacketNumber - number increasing with each packet. When error occured i write all packet numbers into file. I can see for exmaple: 10,11,290,13,14... ). Is there any known differences in WinXP and Win7 for IOCP and multi threading? Or do you konw any free UDP server with IOCP processing?
In procedding loop I only adding packets into buffer and checking their numbers.

Raw USB socket?

Does anyone know how to create a raw socket to a USB device? Like you can create raw sockets to ethernet devices, I would like to send/receive arbitrary data to a USB device.
Depends on the platform - you need a low level USB library.
Either http://sourceforge.net/projects/libusb/ or http://sourceforge.net/projects/libusb-win32/ is a good place to start
ps. It isn't a socket as such, sockets are specific to networks
You can write to the EndPoint using a Raw Socket but a certain protocol needs to be followed for the device to physically accept and reply to commands.
Depending on how the protocol is written you may be able to use a a RawSocket and some Usb sniffer to replay the data to the EndPoint but most devices employ a Timestamp and handshake process which needs to be performed dynamically for each connection and usually involves querying the device state and using the information to complete the handshake along with other information depending on the protocol of the device in question.

IPX protocol - generating frames

Wanted to write better AI for the game Red Alert 2. Game uses IPX protocol for multiplayer. If i'm right, IPX protocol is on Layer 2, so there is only ETH frame without destination/source IP or destination/source Port, so game is running via it's own protocol. Therefore, i could analyse this protocol and programe AI, that would simulate real player. Do you think, tak it is realistic idea? Is there any way how to "generate" and send IPX packet (ETH frame)?
Thanks for any suggestions.
Is there any way how to "generate" and send IPX packet (ETH frame)?
IPX is a layer 3 protocol; but it doesn't contain IP addresses, because it's not an "IP" (internet protocol).
Assuming you're on Windows, the Winsock library is supposed to support IPX: see Winsock IPX/SPX Annex.
IPX is a packet-oriented (not stream-oriented), unreliable (not guaranteed delivery) protocol: like UDP, instead of like TCP.
I expect that using Winsock for IPX is like using Winsock for UDP, except using SOCKADDR_IPX etc.
Do you think, tak it is realistic idea?
If you'll need to reverse-engineer the contents of the packets, using only a packet sniffer, then I expect that will be difficult.