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

  1. Newsgroups: comp.sys.mac.programmer
  2. Path: sparky!uunet!pageworks.com!world!eff!news.byu.edu!gatech!paladin.american.edu!howland.reston.ans.net!bogus.sura.net!udel!intercon!psinntp!ctp!rsanb
  3. From: rsanb@ctp.com (Randall Sanborn)
  4. Subject: MacTCP: MPW C and Think C
  5. Message-ID: <1993Jan26.202734.20702@ctp.com>
  6. Sender: news@ctp.com
  7. Nntp-Posting-Host: looney.ctp.com
  8. Organization: CTP, Inc.
  9. Date: Tue, 26 Jan 1993 20:27:34 GMT
  10. Lines: 49
  11.  
  12. I am having a problem with the MacTCP TCPSend() function in MPW C 3.2, 
  13. but not in Think C 5.0.  The code I had previously written and compiled 
  14. in Think now compiles and links under MPW, but returns an invalidLength 
  15. error on the TCPSend() function.  The MacTCP manual states "the total 
  16. amount of data described by the WDS was either 0 or greater than 65,535 
  17. bytes."  I have checked the length member of the wdsEntry structure, and 
  18. it is between 0 and 64K bytes.  My function is as follows (with some code
  19. extracted):
  20.  
  21. #define ASYNC FALSE
  22.  
  23. foobar(unsigned short len, char *mesg) {
  24.     TCPiopb     *tbp;        // Both pointers are malloc'd
  25.     wdsEntry    *pWds;        // and cleared with 0's
  26.  
  27.     pWds->length    =len;
  28.     pWds->ptr    =mesg;
  29.  
  30.     tbp->tcpStream    =TCPstreamPtr;
  31.     tbp->ioCRefNum    =TCPRefNum;
  32.     tbp->csCode    =TCPSend;    
  33.  
  34.     tbp->csParam.send.wdsPtr=(Ptr)pWds;    
  35.  
  36.     rc = PBControl((ParmBlkPtr)tbp,ASYNC);
  37.  
  38.     tbp->ioResult
  39.     }
  40.  
  41. In MPW, I have checked the sizeof() the TCPiopb and the wdsEntry structs,
  42. they are the same as Think sizeof()'s.  There could be some byte-rounding
  43. problem with this call, but I do not think this is the case, since
  44. I have checked the first 6 bytes of tbp->csParm.send.wdsPtr. Before 
  45. and just after execution of PBControl, the data seems valid. (2 byte
  46. length, and 4 byte address for the mesg address).  
  47.  
  48. If anyone has any idea, I would be happy to hear them.
  49. Also, rc is equal to tbp->ioResult, is this normal?  
  50.  
  51.  
  52. Thank you in advance,
  53.  
  54. Randy
  55.  
  56. -- 
  57.  +     /\/\     Randall M. Sanborn (rsanb@ctp.com)                           +
  58.  |    /-/  \    Cambridge Technology Partners                                |
  59.  |    \--/ /    301 Vassar Street                                            |
  60.  +     \/\/     Cambridge, MA 02139                                          +
  61.