- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Friends
I have image transmitter who transmit Image in form of TCP packet (Server), This Server Send image toward NIOS_II based Client using TCP protocol, now Transmitted TCP packet Size is 640 , but at receiver end few packet 1 or 2 packet differ in size with transmitted packet size please see the attached prientscreen of received packet Regards kaushalLink Copied
5 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Are you looking for long packets as well?
TCP is a byte-stream protocol and the sending system might be merging data blocks before sending them. Possibly this only happens when packets get retransmitted.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello dsl,
Thanking you, i am not expecting big packet. my Image server do the following tasks 1. Read a Raw (Contain only Pixel Info, no header and coding etc) Image of size 640x460. 2. Then Read first 640 byte and pack them in TCP packet, my TCP packet size is 640. total pixel's = 640x460, packet size = 640, then no of packet is = (640x460)/640= 460 SERVER SEND : 460 TCP packet of Size 640. below is the send routine.... do { length = send(sl,DataPacket[LPCount],PktSize,0); if(length <= -1) perror("Send Call failed"); LPCount++; printf("\t%d",length); }while(LPCount != (GPktCount)); 3. Send these packet toward NIOS_II based Client. (Who Collect These packet's ) below is the Receive routine...... LPktCount = 0; do { rc = recv(sockfd,ImgBuff[LPktCount],PktSize,0); if(rc <= -1) perror("Recv Call fail...!!"); printf("%d\t",rc); LPktCount++; }while((LPktCount) != (PktCount)); in both cases PktSIze = 640; Regards kaushal- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That code won't work (as you've found out).
As I said, TCP is a bytestream protocol. The data from the send() calls will very likely be merged together then split into full sized ethernet frames. The recv() will be given a partial length if it 'catches up' with the receive data stream. If you put a marker at the start of each 640 byte block you'll find that you receiver is misaligned on the rx data for most of the trace.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hello dsl,
i am sending a continious 8 bit count value in form of TCP packet, and at receiver end each packet start with count value 145, like 145,146,....255, then 0,1,2,3....127, and the 0 ,1,2,3....to 67, it should be 0 to 255, again 0 to 255 and then 0 to 127 my packet size is 640 (= 256+256+128). received data size full image is in zip format kaushal- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That is the 'short' data, look at the following block of received data as well.
And put a message header and message number in - otherwise you won't see what is happening.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page