order doxycycline online hydrochlorothiazide dosage 25mg 233 tude buspar buy lisinopril medication pillenteiler viagra india pharmacy nexium 20 mg presentacion diflucan in india http://www.bofix.at/index.php/Pharm247-buspar-and-amenorrhea.php india pharmacy cialis nhs viagra online viagra onlineutah click here 5 mg prednisone tired 100mg viagra split get las vegas cost propecia medication dog viagra 10 mg xenical generic cost prices cialis 5mg metformin cause ibs zovirax tablets ireland top 10 online sites prednisone 5 mg pills perth australia metformin drug diabetes australia doxycycline prednisone 10mg overdose buy australia obat diflucan pfizer cialis kaufen erfahrungsbericht diflucan one thrush coupons doxycycline drug facts erythromycin stearate 250mg http://www.bofix.at/ nexium 40 mg bula viagra pill purple no prescription sale complaints online viagra erythromycin thiocyanate buyer clomid unicornuate uterus content prozac buspar interaction cipro cause sleeplessness 5htp wellbutrin together http://www.bofix.at/index.php/Pharm247-20-mg-cialis-review.php metformin split pill cheap kamagra wholesale 50 mg equivalent viagra Refills doxycycline 150 mg reviews cialis overnight USA get viagra doctor apo prednisone uses viagra chewable tablet buspar elderly dementia cialis 10mg generic costco cialis price cheap cialis pharmasy doxycycline tablets cheap viagra amsterdam kaufen cialis 5 mg prospect drug in mexico pharmacy lexapro generic mexico viagra discount prices buy cialis austria synthroid brand generic ada viagra purchase hydrochlorothiazide causes hyperglycemia 5mg cialis free viagra rx4u florida 15mg prednisone alternative discount no prescription metformin drug dose cialis kaufen erfahrungsbericht http://www.bofix.at/index.php/Pharm247-lexapro-30-mg.php strattera 60 mg reviews cialis generic yet get las vegas cialis tablets generic prices usa cialis yearly sales cialis generico tadacip clomid tablet pk diflucan 150 mg daily rxlist bactrim ds viagra pill color safe to buy generic from uk 20 mg lexapro half glucophage pills celebrex use of ordering india farmacia online augmentin 6order propecia cheap pfizer viagra 100 wirkung 25 mg clomid nolvadex 50mg mim 20 mg cialis review effetti abuso cialis indian cialis brands buy viagra buy price drug in uk pharmacy prednisone dosage 100mg propecia .25mg results canada head office kamagra jelly uk nexium 40 mg information indian cialis brands prednisone suspension liquid viagra pill color effet viagra pfizer levitra online paypal zoloft bad drug viagra france prescription lasix injection uses streptococcus and bactrim viagra generic walmart cialis buy malaysia zoloft helps blushing zoloft miracle pill cat costa cialis buspar false positive propecia tabletten wikipedia zovirax prescription information us based viagra regles sous clomid birth control online uk viagra generetic 25 mg generic viagra fourm price lexapro celexa shelf life que prednisone 50 mg nexium 40mg price xenical e pillola generic fake propecia buy viagra atlanta nolvadex 20 mg online pharmacy dapoxetine internetten viagra getirtmek lexapro 30 mg http://www.bofix.at/index.php/Pharm247-cialis-buy-quebec.php lisinopril versus lotensin viagra gold pills lasix anticholinergic drug pegasus airlines cipro lexapro 15mg reviews identify viagra tablets metformin 500mg bd synthroid 30 mg doxycycline mono nausea tab.dapoxetine 30mg buy cialis lloyds cialis sizes prices viagra pill discounts lexapro versus prozac 50 viagra cialis together price lexapro celexa augmentin treatment pertussis no prescription overnight delivery lexapro causing bloating pharmacy order bactrim tabletas dosis rx lisinopril hctz glucophage versus januvia american levitra 20 mg description farmacia online augmentin international zithromax thrush buy bactrim red viagra 50mg cipro 500 mg directions diflucan 150 mg daily
Home Forum Download/Upload Links Search

NetTalk User Group

NetTalk User Group Meeting!
Live Webinar!
Saturday Nov. 16 
7am PST
Click Here To Register!
Home arrow Forum arrow The Rest Of NetTalkarrow The Rest - Share Knowledgearrow Getting length from a non Clarion NetSimple packet
NetTalk Central
April 26, 2015, 05:00:33 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Welcome to the NetTalk Central Forums!
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Getting length from a non Clarion NetSimple packet  (Read 5802 times)
Paul Blais
Newbie
*
Posts: 8



View Profile
« on: August 23, 2011, 06:53:58 PM »

The WholePacket NetSimple Methodis great for NetTalk to NetTalk objects since it sends the length as a 4 byte header and can assemble the packets for you saving some code. (See the manual boundary example).

There is a standard way that many non NetTalk TCP applications use. They send the length as a 4 bytes header but it is no Clarion LONG you can distinguish.

The Bytes are sent as a Big Endian ULONG Integer. This is great until you find out Clarion is not Big Endian So we pretend it's a STRING instead and it's all better. You just need a little funny math.

Should Capesoft add an option  to WholePacket to use Big Endian longs they could make WholePacket work with other players as well as Clarion and it wouldn't break anyones code since we compute length as a Clarion LONG, but NetTalk could use Big Endian as an option and we wouldn't care since it is doing all the work.

The following functions will convert properly (we tested it today with a an Online service)

ToBigEndian            PROCEDURE  (LONG RawVal),STRING   

ByteArray               BYTE,DIM(4)
OutputVal               STRING(4),OVER(ByteArray)

  CODE

  ByteArray[1] = INT(RawVal/256^3)
  ByteArray[2] = INT((RawVal % 256^3) / 256^2)
  ByteArray[3] = INT((RawVal % 256^2) / 256)
  ByteArray[4] = INT(RawVal  % 256)
 
  RETURN OutputVal


And to go the other way:

FromBEndian          PROCEDURE  (STRING RawVal), LONG   

ByteArray               BYTE,DIM(4)
InputVal                STRING(4),OVER(ByteArray)
Result                  LONG

  CODE
  InputVal = RawVal

  Result = (INT(ByteArray[1]) * 256^3 + |
            INT(ByteArray[2]) * 256^2 + |
            INT(ByteArray[3]) * 256   + |
            INT(ByteArray[4]))   ! The packet includes the 4 byte header

  RETURN Result


Special thanks to Marc Walgren of MItten Software for being the tester that would have asked me to fix it if it didn't work..

Logged
Bruce
Global Moderator
Hero Member
*****
Posts: 7426



View Profile
« Reply #1 on: August 23, 2011, 10:39:38 PM »

Hi Paul,

Thanks for the suggestion. The following applies to 5.33 and later.

I've added a property,
WholePacketUseBigEndian
to the NetSimple Class.

This only has affect if the WholePacketUseLengthField property is set. If WholePacketUseBigEndian is set then the incoming length field, and the outgoing length field is added ot the header in "Big Endian" format - ie with the most significant byte first.

If this property is not set then the length field is assumed to be in Little Endian format (ie least significant byte first).

Cheers
Bruce
Logged
Paul Blais
Newbie
*
Posts: 8



View Profile
« Reply #2 on: August 30, 2011, 04:07:08 AM »

Sounds exactly as required Bruce. Thanks for the feature!
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC
Joomla Bridge by JoomlaHacks.com
Valid XHTML 1.0! Valid CSS!

Login Form

Welcome Guest.






Lost Password?
No account yet? Register
home contact search contact search