Win Desktop TCPSocket client gets 102 codes in Mac Desktop

I have a Win Desktop application that connects to websocket server using TCPSocket control and it works well.

Now I have downloaded Xojo for Mac (OS X Lion fresh install with Xojo only) to test the same application and I keep getting a 102 lastErrCode on every single connection attempt. The port number is 21055 which is a safe port to connect to I guess.

Not sure exactly what is happening,… Do I need to instruct Mac OS X to accept the connection ? I am not well versed with Mac.

102 is socket closed and could be the server closing the connection too… Post some code and we can help better…

Maybe this thread will help
https://forum.xojo.com/17314-socket-102-error/0#p143246

It is not a SSL Connection. I get different information onConnect:

This is exactly the same Xojo Binary File and Windows works okay, but Mac returns me:

HTTP/1.0 502 Bad Gateway??Cache-Control: no-cache??Connection: close??Content-Type: text/html????<html><body><h1>502 Bad Gateway</h1>?The server returned an invalid or incomplete response.?</body></html>?

That is on the connect? Nothing written to the server?

onConnect, I send the handshake (which works fine on Windows):

[code] // send http headers for handshake
Dim headers As New InternetHeaders
headers.SetHeader(“Upgrade”, “websocket”)
headers.SetHeader(“Connection”, “Upgrade”)
headers.SetHeader(“Host”, sHost)
headers.SetHeader(“Sec-WebSocket-Version”, “13”)
headers.SetHeader(“Sec-WebSocket-Key”, sKey)

me.Write “GET / HTTP/1.1” + EndOfLine + headers.Source + EndOfLine + EndOfLine[/code]

sKey is a random alphanumeric key as per specs. sHost is not much important in this case but should be an ipAddress.

then I get a dataAvailable with the information posted above; and then the 102 error.

It’s the EndOfLine that’s causing the issue… Use EndOfLine.Windows and it should work fine

Oh Yeah! It worked :slight_smile: Thank you very very much :slight_smile:

Now I am experiencing Encoding issues … @&!$% I hate Mac

Start a new thread for help with the Encoding issues…

I have just changed the framwork from Cocoa to Carbon and … something magic happened! (but I still hate Mac)

Stick with Cocoa, Carbon is going the way of the Dodo

Cocoa = problems with alignments/colors/transparencies … and so on

Start new threads, we can help :slight_smile:

No need, Carbon saved me, lol Thanks. For instance, a custom background color of a texbox shows correctly in Carbon (correct color), with Cocoa it is approximate but is incorrect.