Announcement

Collapse
No announcement yet.

TCP - User Defined Types

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Guest's Avatar
    Guest replied
    Thank You Eric.
    It works as I wanted.
    I din't had a slightest idea about that.

    -------------
    Niraj Bhatt

    Leave a comment:


  • Eric Pearson
    replied
    Niraj --

    If the TCP RECV function returns a string that you call Buffer$ and you want to place the data into a UDT that you call MyUDT, simply do this...

    Code:
    LSET MyUDT = Buffer$
    It would be a good idea to check the length of Buffer$ first, to make sure that it will completely fill MyUDT. If it isn't long enough, PowerBASIC will fill the remaining bytes of MyUDT with CHR$(32), not CHR$(0), and that can result in some bizarre numeric values. A good safety measure would be this...

    Code:
    LSET MyUDT = Buffer$ + STRING$(LEN(MyUDT),0)
    -- Eric

    -------------
    Perfect Sync: Perfect Sync Development Tools
    Email: mailto:[email protected][email protected]</A>



    [This message has been edited by Eric Pearson (edited February 01, 2000).]

    Leave a comment:


  • Guest's Avatar
    Guest started a topic TCP - User Defined Types

    TCP - User Defined Types

    I am able to send a TCP packet With user Defined type like this:
    TCP PRINT hSock, MyPc;

    Where MyPc is a userdefined type Which has
    a As Word
    b AS Word
    c As Long
    Now I am getting the responce with the same format... How can I recive it.
    and cast it in the Userdefined Type. I tried it without success.
    Is there any way to convet or anthing.

    Greatful if anyone can help.


    -------------
    Niraj Bhatt
Working...
X