send x,y-positions?

This is a discussion on send x,y-positions? within the Game Programming forums, part of the General Programming Boards category; no you should send the length you mean strlen(buffer)...

  1. #16
    Registered User
    Join Date
    Dec 2001
    Posts
    479
    no you should send the length you mean strlen(buffer)

  2. #17
    Registered User
    Join Date
    Dec 2001
    Posts
    479
    here
    Attached Files Attached Files

  3. #18
    Nor
    Nor is offline
    h ֆhr s Nor's Avatar
    Join Date
    Nov 2001
    Posts
    299
    you should send its length in bytes.

    i got an old program from about a year ago. i was warking on a chat type server. there be alot of code most dealing with threads.
    i think.

    they thread code be whats mest up. i went to rewrite a section and never finished. but if you read through it should explain most of what i said about phrasing packets.


    nm that i cound my old copy that compiles.
    http://mywebpages.comcast.net/adivin...les/index.html
    Try to help all less knowledgeable than yourself, within
    the limits provided by time, complexity and tolerance.
    - Nor

  4. #19
    Registered User
    Join Date
    Dec 2001
    Posts
    479
    that is what strlen does

  5. #20
    Nor
    Nor is offline
    h ֆhr s Nor's Avatar
    Join Date
    Nov 2001
    Posts
    299
    strlen() returns the number of char's in a null ended string. on some systems a char is more than a byte.
    Try to help all less knowledgeable than yourself, within
    the limits provided by time, complexity and tolerance.
    - Nor

  6. #21
    Registered User
    Join Date
    Dec 2001
    Posts
    479
    you mean less than a byte?
    or which systems do you mean?

  7. #22
    Me -=SoKrA=-'s Avatar
    Join Date
    Oct 2002
    Location
    Europe
    Posts
    448
    >>you mean less than a bye
    No, he means more. That happens with all variable sizes. They all depend on the architecture you're using. 16, 32 or 64 bit processors will have different sizes for a lot of vars. It also depends on other things, but I'm not sure what they are.
    SoKrA-BTS "Judge not the program I made, but the one I've yet to code"
    I say what I say, I mean what I mean.
    IDE: emacs + make + gcc and proud of it.

  8. #23
    Registered User
    Join Date
    Dec 2001
    Posts
    479
    well if is the size that is changed why use sizeof()
    when the size may depend on the system the lenght is always the same

  9. #24
    Me -=SoKrA=-'s Avatar
    Join Date
    Oct 2002
    Location
    Europe
    Posts
    448
    Originally posted by pode
    well if is the size that is changed why use sizeof()
    Your structure won't be null-terminated, so strlen() would give you a crazy number.
    Accrding to the man page of send(), the size is given in size_t which might be different on windows enviroments, so it doesn't really say bytes or chars, although you usually mean bytes, I think.
    SoKrA-BTS "Judge not the program I made, but the one I've yet to code"
    I say what I say, I mean what I mean.
    IDE: emacs + make + gcc and proud of it.

  10. #25
    Nor
    Nor is offline
    h ֆhr s Nor's Avatar
    Join Date
    Nov 2001
    Posts
    299
    from msdn cd
    virtual int Send(const void* lpBuf, int nBufLen, int nFlags = 0 );
    Parameters:
    lpBuf
    A buffer containing the data to be transmitted.
    nBufLen
    The length of the data in lpBuf in bytes.
    nFlags

    Try to help all less knowledgeable than yourself, within
    the limits provided by time, complexity and tolerance.
    - Nor

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. tuncated uint8_t
    By Coens in forum C Programming
    Replies: 14
    Last Post: 11-24-2008, 06:57 AM
  2. nonblocking send need help
    By sleith in forum Networking/Device Communication
    Replies: 2
    Last Post: 03-27-2008, 10:51 PM
  3. sending n no of char data uning send() function,
    By thebrighter in forum Windows Programming
    Replies: 1
    Last Post: 08-22-2007, 12:26 PM
  4. pointers
    By InvariantLoop in forum C Programming
    Replies: 13
    Last Post: 02-04-2005, 08:32 AM
  5. LISP (DrScheme) any one?
    By Jeremy G in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 03-31-2004, 11:52 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21