Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   C++ (http://www.programmingforums.org/forum15.html)
-   -   how i prepare c++ code for implementing my own protocol (http://www.programmingforums.org/showthread.php?t=13741)

amitpansuria Aug 10th, 2007 10:04 AM

how i prepare c++ code for implementing my own protocol
 
helo my protocol format is given below

{ destno,mode,no.of packet,pktsize,,pktno,textsize,CRC}
description:- { is starting flag
destno - 4bytes
mode - 1 byte
no.of pkt - 4byes
pktsize - 6 bytes
pktno 3 bytes
text size 6 bytes
CRC is 2 bytes
i want to write c++ code(or c code) to prepare this packet and after this
i want to transfer this packet over serial port.
after that how i write a code to receive this packet from serial port and how i extract this packet after receiving the packet.
Regards,
Amit
Reply With Quote

Eoin Aug 10th, 2007 12:31 PM

First you'd write code which would take destno, mode, no.of packet, pktsize, pktno, textsize & CRC as variables and package them as you've described. After that you could send that packet across the serial port to a waiting client/server which would undo the packaging giving back the original variables destno, mode, no.of packet, pktsize, pktno, textsize & CRC.

As for the requested quote
Quote:

Originally Posted by me


amitpansuria Aug 11th, 2007 2:27 AM

can u help me with code
 
Quote:

Originally Posted by Eoin (Post 131970)
First you'd write code which would take destno, mode, no.of packet, pktsize, pktno, textsize & CRC as variables and package them as you've described. After that you could send that packet across the serial port to a waiting client/server which would undo the packaging giving back the original variables destno, mode, no.of packet, pktsize, pktno, textsize & CRC.

As for the requested quote

Thx for replying me.
but i m new in this stuff.
can u explain me with code and
u told that after preparing the packet i have to send to client /server
but in serial communication is it possible to implement client -server concept.
anyway first help in writing code for this packet preparation
Thx n Regards,
Amit

mrynit Aug 11th, 2007 5:10 AM

well dont expect to be spoon fed. If you can provide some base code so far may be you should look around the forum some. I do recall seeing some post about writing up your own client/server data sending apps, but im not sure what protocal why were in.

Also as may say use your google Fu.
try looking herer for serial info....might help.....
http://en.wikipedia.org/wiki/Serial_communication

sounds like a nice project.

DaWei Aug 11th, 2007 10:45 AM

Quote:

Thx for replying me.
but i m new in this stuff.
can u explain me with code and
u told that after preparing the packet i have to send to client /server
but in serial communication is it possible to implement client -server concept.
anyway first help in writing code for this packet preparation
Thx n Regards,
Amit
Computer languages require precise syntax. You will need to get into that habit. Addressing us with AOL syntax a la a 10-year old (such as "but i m new") merely tells us that you are too lazy and/or stupid to deserve serious help. Get real. Grow up. Cut your fingernails. No one is using a 300 baud modem these days. "Am" is spelled "A-M", not "M". Capitalization requires the ability to coordinate the pinky in such a way that the shift key is pressed while pressing another key. Can you handle that? If not, you don't need to be trying to learn a programming language.


All times are GMT -5. The time now is 3:12 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC