Servoy and Java Sockets

Hi All! I created small application that could connect to another computer and transfer some data. I have used java.net Socket and ServerSocket. Then i created plugin for servoy based on this application, but it doesn’t transfer data. It connects server, but no data transfer.
Where are my mistakes could be?

Thanks, and sorry for my English :)

even the BEST java-programmer (which i’m not! ;-) ) can not answer this question.
You have to provide, more inside info for that.

It’s the same as asking: 'I have created a beautifull plugin, but it is not working! what is wrong?" :wink:

:oops: I don’t think that it is beautifull, but it is works as Java application that is why i surmise that there are may be some features in Servoy.

In this way i create serversocket usin port#1313.

        try {
            theServer = new ServerSocket(workPort);
            try {
                while (true) {
                    newInConnection((theServer.accept()));
                    for(int i =0; i < connectionNames.size(); i++  )
                        System.out.println("Name "+i+" = "+connectionNames.elementAt(i));            
                }

            }
            catch (IOException e) {
                theServer.close();
                System.err.println(e);
            }

        }  // end try
        catch (IOException e) {
            System.err.println(e);
        }

then, i try to connect from another Computer creating socket object (adress,port # 1313).

This plugin is a simple messanger - frame, incomeTextArea, outcomeTextArea, and sendButton :).

But as plugin it works incorrect. Server creates (means serverSocket object) , gui creates, it gets remote computer name (i know it because it shows as Frame name and i connect by inputing IP). It doesn’t throws any exceptions, and doesn’t tell that could not connect.

I suggest you first get this to work outside of Servoy in case you are not familiar (yet) with the way a plug-in behaves and works.

When you have that working you create the plug-in.

That way you are sure the application works and you can concentrate on the plug-in.

Hope this helps…

Hello,

You can use the FTP Plugin from IT2Be for data transfer within Servoy Solution.
http://www.it2be.com/plugins.htm#ftp

Or, If you want to develop your own plugin, then go for below for better understading of How to Write Servoy Plugin.

http://www.servoy.com/generic.jsp?mt=39 … omy_id=571

IT2Be thanks for your reply. :)

I suggest you first get this to work outside of Servoy in case you are not familiar (yet) with the way a plug-in behaves and works.

But it works great outside of Servoy. But you are right i’m not familiar with the way plugins behaves in Servoy.
Maybe Servoy has some features, maybe because of security it blocks some ports, or maybe there is defined way to work with Net.

IT2Be, did you use sockets in any of your plugins ?

IT2Be, did you use sockets in any of your plugins ?

Yep, and there is no reason why they should not work…

:D Guys, sorry that had wasted your time. I found the my mistake. I had simply forgot to invoke my “delete” method to delete the connection name,after disconnecting, from Vector with names.
. And when i try to connect to the same computer again, server on remote computer accept connection but doesn’t create Form(Gui) because it verify connection names Vector, and find there the same already existing connection name and doesn’t do anythink.
Very stupid blunder. :)

Very stupid blunder.

OK, pay better attention next time :lol: