• 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: Big picture relationships between NSConnection, NSInputStream, NSOutputStream etc
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Big picture relationships between NSConnection, NSInputStream, NSOutputStream etc


  • Subject: Re: Big picture relationships between NSConnection, NSInputStream, NSOutputStream etc
  • From: Andrew Farmer <email@hidden>
  • Date: Sat, 6 Dec 2008 15:45:44 -0800

On 04 Dec 08, at 16:39, Ken Tozier wrote:
<snip...>
I tried it out and got the following printout to the console

> inputStream: <NSCFInputStream: 0x13d170>, outputStream: <NSCFOutputStream: 0x13d1e0>
> connection: <MySQLConnection: 0x824800>
> Entered: stream:handleEvent: with sender: <NSCFInputStream: 0x13d170>
> NSStreamEventErrorOccurred: Error Domain=NSPOSIXErrorDomain Code=61 "Operation could not be completed. Connection refused"
> Entered: stream:handleEvent: with sender: <NSCFOutputStream: 0x13d1e0>


Which seems to make sense because MySQL requires a handshake and NSSocket doesn't know how to respond to that handshake. To perform the handshake, it seems I need to descend into BSD sockets.

This is incorrect. A "connection refused" error in this context means that you're either trying to connect to a host/port which is not configured to accept a connection, or the host is behind a firewall which blocks incoming connections. In this case, it's probably the former. But what you're probably running into here is simply the fact that MySQL doesn't accept TCP connections at all by default - instead, it uses a UNIX domain socket in either /var/tmp/mysql.sock or /tmp/ mysql.sock.


More to the point, though, why are you trying to reimplement the MySQL client library? You haven't even gotten to the wire protocol yet, which I guarantee is going to pose you even more problems than just connecting to the server. If you're just concerned about having to include the library, you can link statically against the libmysqlclient library to avoid having to drag the shared library around with you. (Note, however, that libmysqlclient is licensed under the GPL, so you'll need to talk to Sun if you want to use it in non- free software.)
_______________________________________________


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


  • Follow-Ups:
    • Re: Big picture relationships between NSConnection, NSInputStream, NSOutputStream etc
      • From: Ken Tozier <email@hidden>
References: 
 >Big picture relationships between NSConnection, NSInputStream, NSOutputStream etc (From: Ken Tozier <email@hidden>)
 >Re: Big picture relationships between NSConnection, NSInputStream, NSOutputStream etc (From: John Pannell <email@hidden>)
 >Re: Big picture relationships between NSConnection, NSInputStream, NSOutputStream etc (From: Ken Tozier <email@hidden>)
 >Re: Big picture relationships between NSConnection, NSInputStream, NSOutputStream etc (From: "Michael Ash" <email@hidden>)
 >Re: Big picture relationships between NSConnection, NSInputStream, NSOutputStream etc (From: Ken Tozier <email@hidden>)
 >Re: Big picture relationships between NSConnection, NSInputStream, NSOutputStream etc (From: "Michael Ash" <email@hidden>)
 >Re: Big picture relationships between NSConnection, NSInputStream, NSOutputStream etc (From: Ken Tozier <email@hidden>)

  • Prev by Date: Re: cocoa class diagram
  • Next by Date: Re: cocoa class diagram
  • Previous by thread: Re: Big picture relationships between NSConnection, NSInputStream, NSOutputStream etc
  • Next by thread: Re: Big picture relationships between NSConnection, NSInputStream, NSOutputStream etc
  • Index(es):
    • Date
    • Thread