1. Creating a TCP server? (Rick Mann)
1. Creating a TCP server? (Rick Mann)
- Subject: 1. Creating a TCP server? (Rick Mann)
- From: John MacMullin <email@hidden>
- Date: Tue, 26 Jul 2011 16:20:37 -0700
http://developer.apple.com/library/mac/#samplecode/CocoaEcho/Introduction/Intro.html ?
On Jul 26, 2011, at 2:42 PM, email@hidden wrote:
> Send Cocoa-dev mailing list submissions to
> email@hidden
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://lists.apple.com/mailman/listinfo/cocoa-dev
> or, via email, send a message with subject or body 'help' to
> email@hidden
>
> You can reach the person managing the list at
> email@hidden
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Cocoa-dev digest..."
>
>
> Today's Topics:
>
> 1. Creating a TCP server? (Rick Mann)
> 2. Re: Creating a TCP server? (Eric Gorr)
> 3. Re: App won't get to my code in Lion (Greg Parker)
> 4. Toggle an object (image) when Command key is pressed:
> flagsChanged? (Patrick Robertson)
> 5. Re: Creating a TCP server? (Bing Li)
> 6. Re: Creating a TCP server? (Rick Mann)
> 7. Re: Toggle an object (image) when Command key is pressed:
> flagsChanged? (Quincey Morris)
> 8. Re: Creating a TCP server? (email@hidden)
> 9. Re: App won't get to my code in Lion (Charles Srstka)
> 10. Re: Toggle an object (image) when Command key is pressed:
> flagsChanged? (Kyle Sluder)
> 11. Re: Creating a TCP server? (Tito Ciuro)
> 12. Re: Creating a TCP server? (Eric Gorr)
> 13. Re: Dialog Command Keys (Gregory Weston)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Tue, 26 Jul 2011 12:17:10 -0700
> From: Rick Mann <email@hidden>
> Subject: Creating a TCP server?
> To: Cocoa Developer <email@hidden>
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset=us-ascii
>
> Hi. I need to build a little serial port-to-TCP server (so that clients can connect to my Mac to interact with a serial port). Among other things, I want to advertise this using Bonjour.
>
> How do I create a TCP server in Cocoa? It seems like CF networking is my best bet, but I thought TCP should be easy via Cocoa. I briefly looked at NSSocket and NSStream, but they're not really what I want, I think.
>
> And to verify: is NSNetServices what I need to publish the Bonjour name?
>
> Thanks.
>
> --
> Rick
>
>
>
> ------------------------------
>
> Message: 2
> Date: Tue, 26 Jul 2011 15:23:21 -0400
> From: Eric Gorr <email@hidden>
> Subject: Re: Creating a TCP server?
> To: Rick Mann <email@hidden>
> Cc: Cocoa Developer <email@hidden>
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset=us-ascii
>
> I would suggest checking out the SSD sample project from WWDC 2010. There are a couple of problems in the source which are covered in this thread:
>
> http://lists.apple.com/archives/Macnetworkprog/2011/Jul/msg00005.html
>
> But the basics of what you want to do I believe are there...
>
>
> On Jul 26, 2011, at 3:17 PM, Rick Mann <email@hidden> wrote:
>
>> Hi. I need to build a little serial port-to-TCP server (so that clients can connect to my Mac to interact with a serial port). Among other things, I want to advertise this using Bonjour.
>>
>> How do I create a TCP server in Cocoa? It seems like CF networking is my best bet, but I thought TCP should be easy via Cocoa. I briefly looked at NSSocket and NSStream, but they're not really what I want, I think.
>>
>> And to verify: is NSNetServices what I need to publish the Bonjour name?
>>
>> Thanks.
>>
>> --
>> Rick
>>
>> _______________________________________________
>>
>> Cocoa-dev mailing list (email@hidden)
>>
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>
>> Help/Unsubscribe/Update your Subscription:
>>
>> This email sent to email@hidden
>
>
> ------------------------------
>
> Message: 3
> Date: Tue, 26 Jul 2011 12:48:56 -0700
> From: Greg Parker <email@hidden>
> Subject: Re: App won't get to my code in Lion
> To: John Nairn <email@hidden>
> Cc: email@hidden
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset=windows-1252
>
> On Jul 26, 2011, at 10:34 AM, John Nairn wrote:
>> I was trying to get away with XCode 3.25 on Lion to make a quick fix to my code. I have now installed Xcode 4.1. So far I am getting the same error message. I had this once before in a different application and the solution then was to create a completely new project and manually add all files back in. I will try that soon, but this is a big project and that is not an easy task. I was hoping the issue was similar.
>>
>> Are the LC_VERSION_MIN_MACOSX and LC_FUNCTION_STARTS translations of 0x24 and 0x26. I had been trying to target 10.5 and deploy to 10.4. That could not find the SDK in Xcode 4.1. I switched target to 10.6 (which builds, but lots of warnings) and left deploy at 10.4. I will try changing some more (but I am away from my development Mac until tonight)
>
> "unable to read unknown load command" is reported by the debugger. The Xcode 3.x debugger is unaware of Lion's new load commands.
>
> Those messages should be harmless. The debugger should be able to run and debug your app successfully even without understanding those load commands.
>
> You need to figure out where the app is stuck. Run it, click Pause, and look at the backtraces of all threads.
>
>
> --
> Greg Parker email@hidden Runtime Wrangler
>
>
>
>
> ------------------------------
>
> Message: 4
> Date: Tue, 26 Jul 2011 20:50:03 +0100
> From: Patrick Robertson <email@hidden>
> Subject: Toggle an object (image) when Command key is pressed:
> flagsChanged?
> To: email@hidden
> Message-ID:
> <email@hidden>
> Content-Type: text/plain; charset=UTF-8
>
> Hi all,
>
> I'm wanting to toggle an object between its default and 'alternate' state
> (the object is made up of an image and some text) when the user hits the
> command (③) key. An obvious example is in Xcode 3.2 where if you press â‘¥ the
> 'Build and Run' icon and text changes to 'Build and Debug' (or vice versa,
> depending on your breakpoints)
>
> The object is in a custom view which is a sub (sub) class of NSControl â∫‚
> NSView etc. etc.
>
> I assumed I'd be able to use
>
> - (void)flagsChanged:(NSEvent *)theEvent {
>
> if ([theEvent modifierFlags] &NSCommandKeyMask) {
>
> // change the image
>
> }
>
> // when keys are lifted so there are no modifiers
>
> if ([theEvent modifierFlags] & **NSNoKeys**) {
>
> // set the image back to the original
>
> }
>
> }
>
>
> but have come across a few problems.
>
> First, you can see from the code that I can't seem to find a mask for when
> 'no' modifier keys are pressed. This method does get called for key downs
> and key ups. It seems 'no keys' corresponds to 0x100, but is there no
> constant I can use?
>
> Secondly, this method seems to get called when other key combos are pressed
> (e.g. ③S or ③Q). This means the object/image will flick back/forward, which
> isn't entirely desirable.
>
> Any suggestions would be greatly appreciated.
>
> Thanks
>
>
> ------------------------------
>
> Message: 5
> Date: Wed, 27 Jul 2011 04:00:30 +0800
> From: Bing Li <email@hidden>
> Subject: Re: Creating a TCP server?
> To: Rick Mann <email@hidden>
> Cc: Cocoa Developer <email@hidden>
> Message-ID:
> <CAKnDEhibw0w5R+LR=email@hidden>
> Content-Type: text/plain; charset=ISO-8859-1
>
> Hi, Rick,
>
> If you are familiar with BSD socket, you can program with it to create a TCP
> server. I have done that successfully.
>
> Thanks,
> Bing
>
> On Wed, Jul 27, 2011 at 3:17 AM, Rick Mann <email@hidden> wrote:
>
>> Hi. I need to build a little serial port-to-TCP server (so that clients can
>> connect to my Mac to interact with a serial port). Among other things, I
>> want to advertise this using Bonjour.
>>
>> How do I create a TCP server in Cocoa? It seems like CF networking is my
>> best bet, but I thought TCP should be easy via Cocoa. I briefly looked at
>> NSSocket and NSStream, but they're not really what I want, I think.
>>
>> And to verify: is NSNetServices what I need to publish the Bonjour name?
>>
>> Thanks.
>>
>> --
>> Rick
>>
>> _______________________________________________
>>
>> Cocoa-dev mailing list (email@hidden)
>>
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>
>> Help/Unsubscribe/Update your Subscription:
>>
>> This email sent to email@hidden
>>
>
>
> ------------------------------
>
> Message: 6
> Date: Tue, 26 Jul 2011 13:31:27 -0700
> From: Rick Mann <email@hidden>
> Subject: Re: Creating a TCP server?
> To: Eric Gorr <email@hidden>
> Cc: Cocoa Developer <email@hidden>
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset=us-ascii
>
> Thanks, I saw those messages going by. I'll take a look.
>
> --
> Rick
>
> On Jul 26, 2011, at 12:23 , Eric Gorr wrote:
>
>> I would suggest checking out the SSD sample project from WWDC 2010. There are a couple of problems in the source which are covered in this thread:
>>
>> http://lists.apple.com/archives/Macnetworkprog/2011/Jul/msg00005.html
>>
>> But the basics of what you want to do I believe are there...
>>
>>
>> On Jul 26, 2011, at 3:17 PM, Rick Mann <email@hidden> wrote:
>>
>>> Hi. I need to build a little serial port-to-TCP server (so that clients can connect to my Mac to interact with a serial port). Among other things, I want to advertise this using Bonjour.
>>>
>>> How do I create a TCP server in Cocoa? It seems like CF networking is my best bet, but I thought TCP should be easy via Cocoa. I briefly looked at NSSocket and NSStream, but they're not really what I want, I think.
>>>
>>> And to verify: is NSNetServices what I need to publish the Bonjour name?
>>>
>>> Thanks.
>>>
>>> --
>>> Rick
>>>
>>> _______________________________________________
>>>
>>> Cocoa-dev mailing list (email@hidden)
>>>
>>> Please do not post admin requests or moderator comments to the list.
>>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>>
>>> Help/Unsubscribe/Update your Subscription:
>>>
>>> This email sent to email@hidden
>
>
>
> ------------------------------
>
> Message: 7
> Date: Tue, 26 Jul 2011 13:32:06 -0700
> From: Quincey Morris <email@hidden>
> Subject: Re: Toggle an object (image) when Command key is pressed:
> flagsChanged?
> To: Patrick Robertson <email@hidden>
> Cc: email@hidden
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset=utf-8
>
>
> On Jul 26, 2011, at 12:50, Patrick Robertson wrote:
>
>> First, you can see from the code that I can't seem to find a mask for when
>> 'no' modifier keys are pressed. This method does get called for key downs
>> and key ups. It seems 'no keys' corresponds to 0x100, but is there no
>> constant I can use?
>
> Yes, use the constant 0. Or how about "else"?
>
> if ([theEvent modifierFlags] & NSCommandKeyMask)
> ...
> else // use this ...
> ...
>
> if (([theEvent modifierFlags] & NSCommandKeyMask) == 0) // ... or this ...
> ...
>
> if (!([theEvent modifierFlags] & NSCommandKeyMask)) // ... or this
> ...
>
> I'll also point out that you don't want "'no' modifier keys", you want no *Command* modifier key. Or do you really mean "'no' modifier keys"?
>
>> Secondly, this method seems to get called when other key combos are pressed
>> (e.g. ③S or ③Q). This means the object/image will flick back/forward, which
>> isn't entirely desirable.
>
> Well, of course. You're choosing to use a *modifier* key, which gets pressed first (and sometimes first by quite a long time), and that modifier is already used for other things too. That means it's not highly desirable to use the Command key for modes that are slow to switch or are extremely visible to the user.
>
> If must use Command, you could certainly try delaying the switch in state, but that of course makes it seem less responsive.
>
>
>
>
> ------------------------------
>
> Message: 8
> Date: Tue, 26 Jul 2011 16:38:08 -0400
> From: email@hidden
> Subject: Re: Creating a TCP server?
> To: Rick Mann <email@hidden>, Cocoa Developer
> <email@hidden>
> Message-ID: <email@hidden>
> Content-Type: text/plain; CHARSET=US-ASCII
>
> Here's some sample code (I'm not the author)
>
> https://bitbucket.org/snej/mynetwork/overview
>
> Dave
>
>
> On Jul 26, 2011, at 4:00 PM, Bing Li wrote:
>
>> Hi, Rick,
>>
>> If you are familiar with BSD socket, you can program with it to create a TCP
>> server. I have done that successfully.
>>
>> Thanks,
>> Bing
>>
>> On Wed, Jul 27, 2011 at 3:17 AM, Rick Mann <email@hidden> wrote:
>>
>>> Hi. I need to build a little serial port-to-TCP server (so that clients can
>>> connect to my Mac to interact with a serial port). Among other things, I
>>> want to advertise this using Bonjour.
>>>
>>> How do I create a TCP server in Cocoa? It seems like CF networking is my
>>> best bet, but I thought TCP should be easy via Cocoa. I briefly looked at
>>> NSSocket and NSStream, but they're not really what I want, I think.
>>>
>>> And to verify: is NSNetServices what I need to publish the Bonjour name?
>>>
>>> Thanks.
>>>
>>> --
>>> Rick
>
>
> ------------------------------
>
> Message: 9
> Date: Tue, 26 Jul 2011 16:03:01 -0500
> From: Charles Srstka <email@hidden>
> Subject: Re: App won't get to my code in Lion
> To: John Nairn <email@hidden>
> Cc: email@hidden
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset=windows-1252
>
> On Jul 26, 2011, at 12:19 AM, John Nairn wrote:
>
>> My app won't start at all in Lion. I always thought the first code will be in
>>
>> - (void)applicationWillFinishLaunching:(NSNotification *)aNotification
>>
>> but that code is never reached. So I am a loss of how to fix it.
>>
>> Many of my users claim they can get it running by deleting the folder ~/Library/Icons but other users claim that does not help?
>
> This may be a silly question, but are you sure that your object is set as NSApplication‚s delegate in the nib file?
>
> Charles
>
> ------------------------------
>
> Message: 10
> Date: Tue, 26 Jul 2011 14:11:35 -0700
> From: Kyle Sluder <email@hidden>
> Subject: Re: Toggle an object (image) when Command key is pressed:
> flagsChanged?
> To: Patrick Robertson <email@hidden>
> Cc: email@hidden
> Message-ID:
> <CANEs-czFzQH+vkRYH489hZW+DJDg9xOKtqK8LqPx=email@hidden>
> Content-Type: text/plain; charset=UTF-8
>
> On Tue, Jul 26, 2011 at 12:50 PM, Patrick Robertson
> <email@hidden> wrote:
>> First, you can see from the code that I can't seem to find a mask for when
>> 'no' modifier keys are pressed. This method does get called for key downs
>> and key ups. It seems 'no keys' corresponds to 0x100, but is there no
>> constant I can use?
>
> Did you remember to AND the modifierFlags with
> NSDeviceIndependentModifierFlagsMask?
>
>>
>> Secondly, this method seems to get called when other key combos are pressed
>> (e.g. ③S or ③Q). This means the object/image will flick back/forward, which
>> isn't entirely desirable.
>
> In either 10.5 or 10.6, Apple changed the implementation of NSToolbar
> to avoid this flickering by delaying for a fraction of a second before
> changing its image in response to a -flagsChanged: event. Check the
> AppKit release notes for more info.
>
> --Kyle Sluder
>
>
> ------------------------------
>
> Message: 11
> Date: Tue, 26 Jul 2011 18:14:52 -0300
> From: Tito Ciuro <email@hidden>
> Subject: Re: Creating a TCP server?
> To: email@hidden
> Cc: Rick Mann <email@hidden>, Cocoa Developer
> <email@hidden>
> Message-ID: <email@hidden>
> Content-Type: text/plain; CHARSET=US-ASCII
>
> Hello,
>
> More options:
>
> A simple, extensible HTTP server in Cocoa
> http://cocoawithlove.com/2009/07/simple-extensible-http-server-in-cocoa.html
>
> How to Write a Cocoa Web Server
> http://macdevcenter.com/pub/a/mac/2006/11/14/how-to-write-a-cocoa-web-server.html
>
> A Simple HTTP Server
> http://culturedcode.com/cocoa/
>
> -- Tito
>
> On Jul 26, 2011, at 5:38 PM, email@hidden wrote:
>
>> Here's some sample code (I'm not the author)
>>
>> https://bitbucket.org/snej/mynetwork/overview
>>
>> Dave
>>
>>
>> On Jul 26, 2011, at 4:00 PM, Bing Li wrote:
>>
>>> Hi, Rick,
>>>
>>> If you are familiar with BSD socket, you can program with it to create a TCP
>>> server. I have done that successfully.
>>>
>>> Thanks,
>>> Bing
>>>
>>> On Wed, Jul 27, 2011 at 3:17 AM, Rick Mann <email@hidden> wrote:
>>>
>>>> Hi. I need to build a little serial port-to-TCP server (so that clients can
>>>> connect to my Mac to interact with a serial port). Among other things, I
>>>> want to advertise this using Bonjour.
>>>>
>>>> How do I create a TCP server in Cocoa? It seems like CF networking is my
>>>> best bet, but I thought TCP should be easy via Cocoa. I briefly looked at
>>>> NSSocket and NSStream, but they're not really what I want, I think.
>>>>
>>>> And to verify: is NSNetServices what I need to publish the Bonjour name?
>>>>
>>>> Thanks.
>>>>
>>>> --
>>>> Rick
>> _______________________________________________
>>
>> Cocoa-dev mailing list (email@hidden)
>>
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>
>> Help/Unsubscribe/Update your Subscription:
>>
>> This email sent to email@hidden
>
>
>
> ------------------------------
>
> Message: 12
> Date: Tue, 26 Jul 2011 17:37:54 -0400
> From: Eric Gorr <email@hidden>
> Subject: Re: Creating a TCP server?
> To: Rick Mann <email@hidden>
> Cc: Cocoa Developer <email@hidden>
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset=us-ascii
>
> What, I think distinguishes the SSD example from others is that it uses the two most modern methods to get the job done - launchd and GCD.
>
>
>
> On Jul 26, 2011, at 4:31 PM, Rick Mann <email@hidden> wrote:
>
>> Thanks, I saw those messages going by. I'll take a look.
>>
>> --
>> Rick
>>
>> On Jul 26, 2011, at 12:23 , Eric Gorr wrote:
>>
>>> I would suggest checking out the SSD sample project from WWDC 2010. There are a couple of problems in the source which are covered in this thread:
>>>
>>> http://lists.apple.com/archives/Macnetworkprog/2011/Jul/msg00005.html
>>>
>>> But the basics of what you want to do I believe are there...
>>>
>>>
>>> On Jul 26, 2011, at 3:17 PM, Rick Mann <email@hidden> wrote:
>>>
>>>> Hi. I need to build a little serial port-to-TCP server (so that clients can connect to my Mac to interact with a serial port). Among other things, I want to advertise this using Bonjour.
>>>>
>>>> How do I create a TCP server in Cocoa? It seems like CF networking is my best bet, but I thought TCP should be easy via Cocoa. I briefly looked at NSSocket and NSStream, but they're not really what I want, I think.
>>>>
>>>> And to verify: is NSNetServices what I need to publish the Bonjour name?
>>>>
>>>> Thanks.
>>>>
>>>> --
>>>> Rick
>>>>
>>>> _______________________________________________
>>>>
>>>> Cocoa-dev mailing list (email@hidden)
>>>>
>>>> Please do not post admin requests or moderator comments to the list.
>>>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>>>
>>>> Help/Unsubscribe/Update your Subscription:
>>>>
>>>> This email sent to email@hidden
>>
>>>
>
>
> ------------------------------
>
> Message: 13
> Date: Tue, 26 Jul 2011 17:38:32 -0400
> From: Gregory Weston <email@hidden>
> Subject: Re: Dialog Command Keys
> To: email@hidden
> Message-ID: <email@hidden>
> Content-Type: text/plain; CHARSET=US-ASCII
>
> Bill Appleton wrote:
>
>> Based on my app, the dialog boxes have to be created dynamically, so i can't
>> use Interface Builder, so they are assembled out of cocoa controls as
>> needed.
>>
>> My dialogs beep when i control-x to cut some selected text
>>
>> What is the simple way for my dialog window to pass these command keys
>> events down to the text views?
>>
>> Thanks in advance
>
> Not to be impertinent but through this thread I'm wondering if the OP is putting himself through this pain unnecessarily. There *are* certainly legitimate reasons to be building parts of your UI at runtime but in my experience it's vanishingly rare, especially for the entire application. Is this one of those scenarios where the most beneficial answer to "How do I do X" is "Don't?"
>
> So to Bill: What's the situation for your app that you've decided requires you to build everything at runtime? *Why* can't you use IB?
>
> Greg
>
>
> ------------------------------
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins (at) lists.apple.com
>
> http://lists.apple.com/mailman/listinfo/cocoa-dev
>
>
> End of Cocoa-dev Digest, Vol 8, Issue 570
> *****************************************
>
Best regards,
John MacMullin
Attorney at Law
Developer T_Accounting
Skype: john_macmullin
www.macmullin.info
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden