Java Socket read problem

Phil Davis revdev at pdslabs.net
Tue Apr 6 14:10:25 EDT 2010


Comment inserted below -

On 4/6/10 10:54 AM, Shani wrote:
> HI,
>
> I have problem with the revcode. It cant display
>
> This result.
> Server Started
> Client Syas: AllowServer
>
>
> I start the process then write "AllowServer" as a client but it cant work.
>
> Kindly tell me on which line is the problem,
> Java program is working. Th eproblem is rev side.
>
> StartProcessButton
> ################################################3
> on mouseUp
>      local tDefaultFolder, tProcess
>     --
>     put the defaultFolder into tDefaultFolder
>     set the defaultFolder to StackPath()
>     --
>     put "java Server 54321" into tProcess
>     open process tProcess for neither
>     --
>     set the defaultFolder to tDefaultFolder
> end mouseUp
> ##########################################
>
>
> Socketbutton
> ###########################################
> on mouseUp
>     local tDefaultFolder, tResult, tSocket
>     --
>     put  ("localhost:54321") into tSocket
>
>     open socket tSocket
>     write "AllowServer"&  return to socket tResult
>    

The above line should say:

     write "AllowServer"&  return to socket tSocket

There may be other things, but this one caught my eye.
Phil Davis


>      answer tResult
>
> end mouseUp
> ############################################
>
> function StackPath
>     local tPath
>     --
>     put the effective filename of this stack into tPath
>     set the itemDelimiter to slash
>     delete item -1 of tPath
>     --
>     return tPath
> end StackPath
>
>
>
>
>
>
> Java coding:
>
> import java.io.DataInputStream;
> import java.io.IOException;
> import java.net.ServerSocket;
> import java.net.Socket;
> public class Server {
> public static void main (String[] args) throws IOException{
> ServerSocket server=new ServerSocket(54321);
> System.out.println("Server Started");
> Socket client= server.accept();
> DataInputStream in= new DataInputStream(client.getInputStream());
>
> System.out.println("Client Syas: " + in.readUTF());
> }
> }
>
>
>
> You can see the example on this link:
> http://www.4shared.com/file/258393507/808220ec/javaServer.html
>
>
> Regards,
> SHANI
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
>    

-- 
Phil Davis

PDS Labs
Professional Software Development
http://pdslabs.net




More information about the use-livecode mailing list