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?
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.
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 ?
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.