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