Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Fri Dec 15, 2017 8:37 pm
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: SSLSocket with ServerSocket does not establish connection
PostPosted: Sun Mar 31, 2013 1:00 pm 
Offline

Joined: Thu Apr 21, 2011 9:44 pm
Posts: 12
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


Top
 Profile  
Reply with quote  
 Post subject: Re: SSLSocket with ServerSocket does not establish connectio
PostPosted: Thu Apr 11, 2013 2:39 pm 
Offline
User avatar

Joined: Sun Aug 12, 2007 10:10 am
Posts: 1086
Location: Boiling Springs, SC
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

_________________
Matthew A. Combatti
Real Studio 2012 r1.2

Visit Xojo Developer's Spot!
Systems I Use:
Windows XP/Windows Vista/Windows Server 2008 r2/Windows 7/Windows 8
Mac OSX 10.5/Mac OSX 10.6/Mac OSX Server/Ubuntu/Debian/Suse/Red Hat/
Windows Server 2011/CentOS 5.4 /ReactOS/SimOS

~All Xojo Compatible~


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group