Know a good article or link that we're missing? Submit it!

View java\java\bin\manoveg\client\ClientT.java

networking authentication program 1.0

Submitted By: manoveg
Rating: (Not rated) (Rate It)


package client;
import server.*;
import java.io.*;
import java.net.*;

public class ClientT
{
 public static void main(String args[])
 {
        int ch=0,i=0;
        char[] str1=new char[30];

   try
      {
       Socket s1 = new Socket("Localhost",8189);
       OutputStream out = s1.getOutputStream();
//       BufferedReader br1 = new BufferedReader(new InputStreamReader(s1.getInputStream()));


        InputStream im=s1.getInputStream();
       BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
       String temp=br.readLine();
       byte buf[]=temp.getBytes();
       out.write(buf);
       out.close();
       System.out.println(" out is closed");
       System.out.println(" br1 is opened");

        while((ch=im.read())!=-1)
        {
                str1[i]=(char)ch;
                i++;
        }
        String str=new String(str1);
        System.out.println(str);
        }
      catch(Exception e)
      {
        System.out.println(e);
       }


   }
 }
 
corner
© 1996-2008. All rights reserved. Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Publisher: Lars Hagelin.
bootstrapLabs Logo A bootstrapLabs project.