-
Notifications
You must be signed in to change notification settings - Fork 401
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UDP server is not working with me #6
Comments
@hishambakr |
Thanks for reply, I receive message but null. I switched now to another library called "CocoaAsyncSocket" it is objective c but I used in in Swift and now I receive string message correctly |
@hishambakr thanks for your feedback, i will check it. |
Hi, i seemed to found a line of code that prevents UdpServer from working properly, in yudpsocket.c line 60: |
Yeah got the same problem here. The tests even written (testudpserver, testudpclient) don't work. @yamiyukiharu Looked that up and made a few adjustments to the "yudpsocket_server" function that made it work:
} |
I can confirm the fix above works. @iain17 thanks! |
Thank you very much for great effort.
I connect to Java server. server receive string message correctly.
when server reply to me with string message, callback is called but data,remoteip,remoteport are nil
I use this code :
func testudpserver(){
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), { () -> Void in
var server:UDPServer=UDPServer(addr:"127.0.0.1",port:19876)
var run:Bool=true
while run{
var (data,remoteip,remoteport)=server.recv(1024)
println("recive")
if let d=data{
if let str=String(bytes: d, encoding: NSUTF8StringEncoding){
println(str)
}
}
println(remoteip)
server.close()
break
}
})
}
The text was updated successfully, but these errors were encountered: