troubleshooting Question

500: simply send hex

Avatar of smotbd
smotbd asked on
PHP
12 Comments1 Solution321 ViewsLast Modified:
I am implementing a simple protocol and TWO bytes of this protocol represents the packet sequence number.....so this must increment by one on each packet sent. How can I increment a value and send it as hex?
I have started as follows:

$count = 0;   //set $count with initial value of 0

for ($i = 1; $i <= 1000; $i++) {     //for-loop to loop certain amount of times...

echo $seq = sprintf("%04x<P>", $count); //put $count in to variable $seq in 2-byte hex format
   
/*now, how should I send these hex values? When I send $seq as it is then it appears as ascii on the other side of the
network and then the ethereal shows up the hex equivalent of the ascii sent........but I want it sent as hex in the first place. echo $seq clearly shows $seq incrementing in 2-byte hex so why aren't the values sent as hex when I send $seq. WHat do I need to do to it. */

$count++; increment
}

Please complete the above or feel free to change the above completely....just aslong as it works!!

I need this resolved asap please...hence 500pnts
Thank you v much
ASKER CERTIFIED SOLUTION
Computer101

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 12 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 12 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros