Re: Mac TCP Programming
Yes, that is what is does, I have however since the last post traced the problem to a degree anyway, I put it down to [1] the problem was when I was running through the debugger, and [2] I have no mac UI of any sort as I am using Think C's console (so I can printf and see what is going on), this I believe was not supplying any events so the WaitNextEvent was just sitting there. Pretty much the whole of Mac OS lives in the UI. You can't get mouse and keyboard (or even, I suspect, disk I/O) without WaitNextEvent()ing somewhere. But maybe I misunderstand what Think C's console is. Is it some kind of serial-port console or something? -- Compact Macs is sponsored by http://lowendmac.com/. Support Low End Mac http://lowendmac.com/lists/support.html Compact Macs list info: http://lowendmac.com/lists/compact.shtml -- AOL users, remove mailto:; Send list messages to: mailto:compact.macs@mail.maclaunch.com To unsubscribe, email: mailto:[EMAIL PROTECTED] For digest mode, email: mailto:[EMAIL PROTECTED] Subscription questions: mailto:[EMAIL PROTECTED] Archive:http://www.mail-archive.com/compact.macs%40mail.maclaunch.com/ --- iPod Accessories for Less at 1-800-iPOD.COM Fast Delivery, Low Price, Good Deal www.1800ipod.com ---
Re: Mac TCP Programming
Yes, that is what is does, I have however since the last post traced the problem to a degree anyway, I put it down to [1] the problem was when I was running through the debugger, and [2] I have no mac UI of any sort as I am using Think C's console (so I can printf and see what is going on), this I believe was not supplying any events so the WaitNextEvent was just sitting there. OK, I just caught this. As I understand it, the low-level TCP code is supposed to be generating events that will satisfy WaitNextEvent(). It's possible that the TCP stack is poorly integrated with Mac OS and is using some other signalling mechanism. If that's the case, your socket code probably needs to pick up the slack and provide the necessary glue to feed packets into the event stream by making the sockets into file handles. -- Compact Macs is sponsored by http://lowendmac.com/. Support Low End Mac http://lowendmac.com/lists/support.html Compact Macs list info: http://lowendmac.com/lists/compact.shtml -- AOL users, remove mailto:; Send list messages to: mailto:compact.macs@mail.maclaunch.com To unsubscribe, email: mailto:[EMAIL PROTECTED] For digest mode, email: mailto:[EMAIL PROTECTED] Subscription questions: mailto:[EMAIL PROTECTED] Archive:http://www.mail-archive.com/compact.macs%40mail.maclaunch.com/ --- iPod Accessories for Less at 1-800-iPOD.COM Fast Delivery, Low Price, Good Deal www.1800ipod.com ---
Re: Mac TCP Programming
Pretty much the whole of Mac OS lives in the UI. You can't get mouse and keyboard (or even, I suspect, disk I/O) without WaitNextEvent()ing somewhere. But maybe I misunderstand what Think C's console is. Is it some kind of serial-port console or something? The Think C Console gives a STDIO window that makes porting console command line apps possible on the Mac, it means I can get to grips with the network side of System 7 programming without having to learn the UI side for the moment. Luckily the first apps I have in mind don't require a UI they just need to startup do their business and shut down quietly. Regards Sean. -- Classic Computing Pages: http://www.megadon.co.uk/syrinx/ -- Compact Macs is sponsored by http://lowendmac.com/. Support Low End Mac http://lowendmac.com/lists/support.html Compact Macs list info: http://lowendmac.com/lists/compact.shtml -- AOL users, remove mailto:; Send list messages to: mailto:compact.macs@mail.maclaunch.com To unsubscribe, email: mailto:[EMAIL PROTECTED] For digest mode, email: mailto:[EMAIL PROTECTED] Subscription questions: mailto:[EMAIL PROTECTED] Archive:http://www.mail-archive.com/compact.macs%40mail.maclaunch.com/ --- iPod Accessories for Less at 1-800-iPOD.COM Fast Delivery, Low Price, Good Deal www.1800ipod.com ---
Re: Mac TCP Programming
believe was not supplying any events so the WaitNextEvent was just sitting there. OK, I just caught this. As I understand it, the low-level TCP code is supposed to be generating events that will satisfy WaitNextEvent(). It's possible that the TCP stack is poorly integrated with Mac OS and is using some other signalling mechanism. If that's the case, your socket code probably needs to pick up the slack and provide the necessary glue to feed packets into the event stream by making the sockets into file handles. Well the TCP stack I prefer is MacTCP as OpenTransport is too big for compacts IMO. As I now know the debugger is getting in the way of the Event Mechanism I should hopefully be able to look out for future problems, I'll keep the list posted on my progress. Regards Sean. -- Classic Computing Pages: http://www.megadon.co.uk/syrinx/ -- Compact Macs is sponsored by http://lowendmac.com/. Support Low End Mac http://lowendmac.com/lists/support.html Compact Macs list info: http://lowendmac.com/lists/compact.shtml -- AOL users, remove mailto:; Send list messages to: mailto:compact.macs@mail.maclaunch.com To unsubscribe, email: mailto:[EMAIL PROTECTED] For digest mode, email: mailto:[EMAIL PROTECTED] Subscription questions: mailto:[EMAIL PROTECTED] Archive:http://www.mail-archive.com/compact.macs%40mail.maclaunch.com/ --- iPod Accessories for Less at 1-800-iPOD.COM Fast Delivery, Low Price, Good Deal www.1800ipod.com ---
Mac TCP Programming
Hello, I hope it is ok to ask development questions on this list, it should be on topic as I am developing apps for compacts ;-) Now, I don't know much about system 7 programming, so I hope someone here knows more... I am using Think C and I am attempting to develop a library similar to simple sockets that will allow me to easily port some of my unix tcp apps to the compact, the first one is just a trial app to retreive the daytime message on port 13 from a unix machine on my network, I am having a lot of problems but the current issue is with the spin routine which calls WaitNextEvent, this routine is called while waiting for MacTCP to do its thing. The problem I'm having is the Spin routine sometimes just loops round and I think it may have something to do with being called too quickly in succession. The reason I think this is if add the following code I can sort of get a reliable connection: static long lastTickCount; if(lastTickCount==0) lastTickCount=TickCount(); while(TickCount() lastTickCount+5) SystemTask(); lastTickCount=TickCount(); Now I googled around to find SystemTask() which I was hoping would be like Windows DoEvents() or Unix Sleep statements, but I'm not sure. Has anyone got any suggestions or even better some example Think C 5 code that connects to a tcp port, I've got an example TCP server but not a TCP client. Regards Sean. -- Classic Computing Pages: http://www.megadon.co.uk/syrinx/ -- Compact Macs is sponsored by http://lowendmac.com/. Support Low End Mac http://lowendmac.com/lists/support.html Compact Macs list info: http://lowendmac.com/lists/compact.shtml -- AOL users, remove mailto:; Send list messages to: mailto:compact.macs@mail.maclaunch.com To unsubscribe, email: mailto:[EMAIL PROTECTED] For digest mode, email: mailto:[EMAIL PROTECTED] Subscription questions: mailto:[EMAIL PROTECTED] Archive:http://www.mail-archive.com/compact.macs%40mail.maclaunch.com/ --- iPod Accessories for Less at 1-800-iPOD.COM Fast Delivery, Low Price, Good Deal www.1800ipod.com ---
Re: Mac TCP Programming
WaitNextEvent() should throw you into the system event loop, you shouldn't have to call SystemTask() or anything else. I'm sure you know this, but just in case... classic Mac OS applications ran in an environment quite unlike any modern multitasking environment. They were more like UNIX kernel processes, and had to explicitly yield the CPU before any action could be taken on their behalf by the OS. Even in the last versions of Mac OS, multitasking was never an invisible undercurrent of activity that only troubles a process when it cares about real-time events or when it has to coordinate itself with another process. But WaitNextEvent (the CPU-friendly version of the original GetNextEvent) should do everything you need... so long as you get to it in time. I don't know what Spin() looks like, but if it's the event handler for your networking code it has to call WaitNextEvent or at least GetNextEvent at least once in every pass through it, and at least once in a while in every long-running loop. -- Compact Macs is sponsored by http://lowendmac.com/. Support Low End Mac http://lowendmac.com/lists/support.html Compact Macs list info: http://lowendmac.com/lists/compact.shtml -- AOL users, remove mailto:; Send list messages to: mailto:compact.macs@mail.maclaunch.com To unsubscribe, email: mailto:[EMAIL PROTECTED] For digest mode, email: mailto:[EMAIL PROTECTED] Subscription questions: mailto:[EMAIL PROTECTED] Archive:http://www.mail-archive.com/compact.macs%40mail.maclaunch.com/ --- iPod Accessories for Less at 1-800-iPOD.COM Fast Delivery, Low Price, Good Deal www.1800ipod.com ---
Re: Mac TCP Programming
WaitNextEvent() should throw you into the system event loop, you shouldn't have to call SystemTask() or anything else. I was using SystemTask as more of a waste some time here before getting to the WaitNextEvent really, I was just hoping it would be process friendly. I'm sure you know this, but just in case... classic Mac OS applications ran in an environment quite unlike any modern multitasking environment. They were more like UNIX kernel processes, and had to explicitly yield the CPU before any action could be taken on their behalf by the OS. Even in the last versions of Mac OS, multitasking was never an invisible undercurrent of activity that only troubles a process when it cares about real-time events or when it has to coordinate itself with another process. I've programmed various machines and OS with differing process capabilities but I will bear that in mind and it does explain why the system clock can be frozen quite easily! But WaitNextEvent (the CPU-friendly version of the original GetNextEvent) should do everything you need... so long as you get to it in time. I don't know what Spin() looks like, but if it's the event handler for your networking code it has to call WaitNextEvent or at least GetNextEvent at least once in every pass through it, and at least once in a while in every long-running loop. Yes, that is what is does, I have however since the last post traced the problem to a degree anyway, I put it down to [1] the problem was when I was running through the debugger, and [2] I have no mac UI of any sort as I am using Think C's console (so I can printf and see what is going on), this I believe was not supplying any events so the WaitNextEvent was just sitting there. Anyway when my code is run direct it does appear to work, at least to the degree I have it now, I still need to figure out sending and receiving data and trying to work out why I can't get the resolver to work :-( Regards Sean. -- Classic Computing Pages: http://www.megadon.co.uk/syrinx/ -- Compact Macs is sponsored by http://lowendmac.com/. Support Low End Mac http://lowendmac.com/lists/support.html Compact Macs list info: http://lowendmac.com/lists/compact.shtml -- AOL users, remove mailto:; Send list messages to: mailto:compact.macs@mail.maclaunch.com To unsubscribe, email: mailto:[EMAIL PROTECTED] For digest mode, email: mailto:[EMAIL PROTECTED] Subscription questions: mailto:[EMAIL PROTECTED] Archive:http://www.mail-archive.com/compact.macs%40mail.maclaunch.com/ --- iPod Accessories for Less at 1-800-iPOD.COM Fast Delivery, Low Price, Good Deal www.1800ipod.com ---