ios - Domain=NSPOSIXErrorDomain Code=61 -
i'm trying connect between client(ios app) , server(node.js) using socketrocket , ws below.
ios(socketrocket):
nsurl *url = [nsurl urlwithstring:@"ws://localhost:8080"]; srwebsocket *_socket = [srwebsocket alloc] initwithurlrequest:[nsurlrequest requestwithurl:url]; _socket.delegate = self; [_socket open]; /* srwebsocketdelegate */ -(void)websocketdidopen:(srwebsocket*)websocket{ [websocket send:@"something"]; } -(void)websocket:(srwebsocket*)websocket didreceivemessage:(id)message{ nslog(@"didreceivemessage: %@",[message description]); } -(void)websocket:(srwebsocket*)websocket didfailwitherror:(nserror*)error{ nslog(@"the error: %@",error); }
node.js(ws):
var websocketserver = require('ws').server var wss = new websocketserver({ host:'localhost', port:8080 }); wss.on('connection',function(ws){ ws.on('message',function(message){ console.log('received: %s', message); ws.send(message); }); });
then, got message below:
the error: error domain=nsposixerrordomain code=61 "the operation couldn’t completed. connection refused"
i've searched solve this, couldn't find solution this. how solve this??
connecting wi-fi network on iphone. maybe solved problem.
Comments
Post a Comment