• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Cocoa Examples Using Sockets?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cocoa Examples Using Sockets?


  • Subject: Re: Cocoa Examples Using Sockets?
  • From: René Puls <email@hidden>
  • Date: Tue, 11 Nov 2003 08:01:23 +0100

Hello Conrad,

Am 10.11.2003 um 21:32 schrieb <email@hidden>:

Hi, could someone tell me where I can find examples of using sockets framework/classes under Cocoa?

I found a very simple and easy to use wrapper class for sockets in the open-source iJournal project. The only limitation is that it currently works only with NSStrings, so it's probably not useful for binary protocols. (It might be possible to change that, though.)

The class is called IJSimpleSocket and can be downloaded from the CVS tree:

http://cvs.sourceforge.net/viewcvs.py/ijournal/iJournal/

You need both IJSimpleSocket.h and IJSimpleSocket.m:

http://cvs.sourceforge.net/viewcvs.py/*checkout*/ijournal/iJournal/ IJSimpleSocket.h?content-type=text/plain&rev=1.1
http://cvs.sourceforge.net/viewcvs.py/*checkout*/ijournal/iJournal/ IJSimpleSocket.m?rev=1.5.2.1

There are two references to an "IJInfoPanelCtrl" class, once in the header and once in the implementation, which you can simply delete.

Once you've done this, using the class is easy:

IJSimpleSocket *mySocket = [[IJSimpleSocket alloc] initWithHostName:@"my.webserver.com"
andPort:80];
NSString *response = [mySocket getResponseFromSending:@"GET /"];

I found this very helpful for all kinds of text-based protocols like HTTP or NNTP.

Kind regards,
Rene Puls

PS: This source code is available under a BSD-style license, so you may use it even in your own binary-only programs, as long as you reproduce the copyright notice of the author somewhere in your application. I am neither a lawyer nor the author, so please verify this before using the code for serious business. :-)
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
  • Follow-Ups:
    • Re: Cocoa Examples Using Sockets?
      • From: René Puls <email@hidden>
References: 
 >Cocoa Examples Using Sockets? (From: <email@hidden>)

  • Prev by Date: Re: NSView subclass bindings? NSTextView? (WebView?)
  • Next by Date: Re: NSView subclass bindings? NSTextView? (WebView?)
  • Previous by thread: Re: Cocoa Examples Using Sockets?
  • Next by thread: Re: Cocoa Examples Using Sockets?
  • Index(es):
    • Date
    • Thread