home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / sys / mac / programm / 22254 < prev    next >
Encoding:
Text File  |  1993-01-27  |  1.8 KB  |  47 lines

  1. Newsgroups: comp.sys.mac.programmer
  2. Path: sparky!uunet!pageworks.com!world!eff!sol.ctr.columbia.edu!usc!sdd.hp.com!ux1.cso.uiuc.edu!news.cso.uiuc.edu!resnick
  3. From: resnick@cogsci.uiuc.edu (Pete Resnick)
  4. Subject: Re: MacTCP: MPW C and Think C
  5. References: <1993Jan26.202734.20702@ctp.com>
  6. Message-ID: <C1HHL4.MF7@news.cso.uiuc.edu>
  7. Sender: usenet@news.cso.uiuc.edu (Net Noise owner)
  8. Organization: University of Illinois at Urbana
  9. Date: Tue, 26 Jan 1993 23:07:52 GMT
  10. Lines: 35
  11.  
  12. rsanb@ctp.com (Randall Sanborn) writes:
  13.  
  14. >I am having a problem with the MacTCP TCPSend() function in MPW C 3.2, 
  15. >but not in Think C 5.0.  The code I had previously written and compiled 
  16. >in Think now compiles and links under MPW, but returns an invalidLength 
  17. >error on the TCPSend() function.  The MacTCP manual states "the total 
  18. >amount of data described by the WDS was either 0 or greater than 65,535 
  19. >bytes."  I have checked the length member of the wdsEntry structure, and 
  20. >it is between 0 and 64K bytes.  My function is as follows (with some code
  21. >extracted):
  22.  
  23. >    TCPiopb     *tbp;        // Both pointers are malloc'd
  24. >    wdsEntry    *pWds;        // and cleared with 0's
  25.  
  26. >    pWds->length    =len;
  27. >    pWds->ptr    =mesg;
  28.  
  29. It looks like you calloc'ed just enough room for 1 wdsEntry. You have
  30. no 0 terminator.  I'll make a bet you are just getting lucky in THINK C
  31. because there is a word of 0 after pWds in memory. You need to say:
  32.  
  33.     pWds = NewPtrClear(sizeof(wdsEntry) + sizeof(short));
  34.  
  35.         or
  36.  
  37.     pWds = calloc(sizeof(wdsEntry) + sizeof(short));
  38.  
  39. That will give you a 0 terminator at the end of your wdsEntry.
  40.  
  41. pr
  42. -- 
  43. Pete Resnick             (...so what is a mojo, and why would one be rising?)
  44. Graduate assistant - Philosophy Department, Gregory Hall, UIUC
  45. System manager - Cognitive Science Group, Beckman Institute, UIUC
  46. Internet: resnick@cogsci.uiuc.edu
  47.