robbiehanson / CocoaHTTPServer

A small, lightweight, embeddable HTTP server for Mac OS X or iOS applications
Other
5.59k stars 1.31k forks source link

code = -1004 desc = Error Domain=NSURLErrorDomain Code=-1004 #204

Open free1990 opened 4 years ago

free1990 commented 4 years ago

I found a problem on product evn, here is error log , anyone can help?

code = -1004 desc = Error Domain=NSURLErrorDomain Code=-1004 "Could not connect to the server." UserInfo={NSErrorFailingURLKey=http://localhost:49786/index.html?...., _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <A2E88C08-0CF7-462D-8EB9-D6F960983E65>.<16>, _kCFStreamErrorCodeKey=61, NSLocalizedDescription=Could not connect to the server., _WKRecoveryAttempterErrorKey=<WKReloadFrameErrorRecoveryAttempter: 0x2822d7560>, networkTaskDescription=LocalDataTask <A2E88C08-0CF7-462D-8EB9-D6F960983E65>.<16>, _kCFStreamErrorDomainKey=1, NSErrorFailingURLStringKey=http://localhost:49786/index.html?...., NSUnderlyingError=0x282c26010 {Error Domain=kCFErrorDomainCFNetwork Code=-1004 "(null)" UserInfo={_kCFStreamErrorCodeKey=61, _kCFStreamErrorDomainKey=1}}}

fahadhaq commented 4 years ago

Hey we are having the same issue, We solved it by starting the server when we need to use it and killing the server after we finish with it. We used to have it running for the length of the time we were using the app and seems the server didn't like that. Prob not the best solution but hope it will help.

ehsanmehrabi commented 3 years ago

T

Tonyvalony commented 3 years ago

I found a problem on product evn, here is error log , anyone can help?

code = -1004 desc = Error Domain=NSURLErrorDomain Code=-1004 "Could not connect to the server." UserInfo={NSErrorFailingURLKey=http://localhost:49786/index.html?...., _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <A2E88C08-0CF7-462D-8EB9-D6F960983E65>.<16>, _kCFStreamErrorCodeKey=61, NSLocalizedDescription=Could not connect to the server., _WKRecoveryAttempterErrorKey=<WKReloadFrameErrorRecoveryAttempter: 0x2822d7560>, networkTaskDescription=LocalDataTask <A2E88C08-0CF7-462D-8EB9-D6F960983E65>.<16>, _kCFStreamErrorDomainKey=1, NSErrorFailingURLStringKey=http://localhost:49786/index.html?...., NSUnderlyingError=0x282c26010 {Error Domain=kCFErrorDomainCFNetwork Code=-1004 "(null)" UserInfo={_kCFStreamErrorCodeKey=61, _kCFStreamErrorDomainKey=1}}}

Tonyvalony commented 3 years ago

I found a problem on product evn, here is error log , anyone can help?

code = -1004 desc = Error Domain=NSURLErrorDomain Code=-1004 "Could not connect to the server." UserInfo={NSErrorFailingURLKey=http://localhost:49786/index.html?...., _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <A2E88C08-0CF7-462D-8EB9-D6F960983E65>.<16>, _kCFStreamErrorCodeKey=61, NSLocalizedDescription=Could not connect to the server., _WKRecoveryAttempterErrorKey=<WKReloadFrameErrorRecoveryAttempter: 0x2822d7560>, networkTaskDescription=LocalDataTask <A2E88C08-0CF7-462D-8EB9-D6F960983E65>.<16>, _kCFStreamErrorDomainKey=1, NSErrorFailingURLStringKey=http://localhost:49786/index.html?...., NSUnderlyingError=0x282c26010 {Error Domain=kCFErrorDomainCFNetwork Code=-1004 "(null)" UserInfo={_kCFStreamErrorCodeKey=61, _kCFStreamErrorDomainKey=1}}}

fahadhaq commented 3 years ago

@Tonyvalony how long is the server running before you get the error? What we found is that if the server running for a long period of time the server stops responding. Had to change code to only run the server when we need to show the web page. Hope this helps