NSPOSIXErrorDomain Error Code 57

I was writing an iOS app to connect to a socket server.  When I ran on the simulator, I kept getting error and disconnected immediately.  The Error Code was 57, and Error Domain is NSPOSIXErrorDomain.  I was scratching my head for awhile because I knew that I tested it and it was working when I first time running it.

After an hour of research, I found out the reason.  When changing the network, I have to restart the iOS simulator.  After I restarted the simulator, the socket connection was working again.  FML!  LOL!

Read More