Real Software Forums
http://forums.realsoftware.com/

SSLSocket with ServerSocket does not establish connection
http://forums.realsoftware.com/viewtopic.php?f=2&t=47455
Page 1 of 1

Author:  gm1 [ Sun Mar 31, 2013 1:00 pm ]
Post subject:  SSLSocket with ServerSocket does not establish connection

Hi all

I built a very simple server and client to collect data from some sites (client side), include in JSON stream and send to a server side, both as console application.
Using SSLSocket with Secure = False works good, no problems at all. But, when Secure is enabled no connection is made on the server side. The client is running on Linux and the server on Mac.

I also tested building a certificate file, with the following commands:

    ssh-keygen -t rsa
    openssl req -new -key collector.key -out collector.csr
    openssl x509 -req -days 365 -in collector.csr -signkey collector.key -out collector.crt

The key and crt file was concat'd, but the result is the same.

Using tshark on the client side:
http://pastebin.com/YLDW6wwY

The code on the server side is:

Server side, ServerSocket AddSocket:

Dim Ret as Class_SecureTCP = New Class_SecureTCP
dim f as FolderItem

if DebugBuild Then
f = GetFolderItem("").Parent.Child("collector.crt")
else
f = GetFolderItem("").Child("collector.crt")
end if

SocketIndex = SocketIndex + 1
Ret.SocketId = socketIndex
ret.CertificateFile = f
ret.Secure = True

return Ret


Client side:

st = new Class_SecureTCP
dim f as FolderItem

if DebugBuild Then
f = GetFolderItem("").Parent.Child("collector.crt")
else
f = GetFolderItem("").Child("collector.crt")
end if

st.Address = mainConfig.Value("remoteip")
st.Port = mainConfig.Value("remoteport")
st.CertificateFile = f
st.Secure = True
st.Connect

tout = Ticks() + 600
do until st.IsConnected
tact = Ticks()
if tact > tout Then
exit do
end if
App.DoEvents(10)
loop

if not st.IsConnected Then
clog(CurrentMethodName, "Unable to connect to remote socket")
exit sub
end if

st.Write(coll.ToString)
st.Flush


What am I doing wrong?

Thanks in advance,

Gustavo

Author:  simulanics [ Thu Apr 11, 2013 2:39 pm ]
Post subject:  Re: SSLSocket with ServerSocket does not establish connectio

What is the port number (443?)? anything under certain port values you will need to run the server as an administrator/root. The code seems to appear fine on my end

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/