Page 2 of 2 FirstFirst 12
Results 21 to 39 of 39
  1. #21
    snowhite is offline Member
    Join Date
    Apr 2012
    Posts
    23
    Rep Power
    0

    Default Re: java networking problem

    atleast diplay to me the compiler errors that u r getting....i,ll try my level best to understand wht u r trying to tell me...plz copy paste the compiler errors here...thanks..

  2. #22
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,902
    Rep Power
    25

    Default Re: java networking problem

    How are you compiling the code? You need to fix the compiler so it gives you the error messages. If you do not get the error messages there is something wrong with how you are compiling the code. If you don't fix that, then you will continue to have this kind of problem with any program that you write.

    i am using the same api and compilers as u use..
    Use the javac command in the command prompt and copy and paste here the contents of the console window.
    To copy the contents of the command prompt window:
    Click on Icon in upper left corner
    Select Edit
    Select 'Select All' - The selection will show
    Click in upper left again
    Select Edit and click 'Copy'

    Paste here.
    If you don't understand my response, don't ignore it, ask a question.

  3. #23
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,902
    Rep Power
    25

    Default Re: java networking problem

    You must be using a different version of the source than what was posted. Please post the current version of your code.
    If you don't understand my response, don't ignore it, ask a question.

  4. #24
    snowhite is offline Member
    Join Date
    Apr 2012
    Posts
    23
    Rep Power
    0

    Default Re: java networking problem

    i am compiling in the following manner

    javac <class name>.java

    running in the following mannner


    java <classname>

    can u plz do wht i say.....plz whatever compiler errors u r getting through my program copy and paste them here...thats all....ill check them and let u know....

    as for me....the program is compiling and running ABSOLUTELY FINE...

  5. #25
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,902
    Rep Power
    25

    Default Re: java networking problem

    Your version of the code must be different than the one posted in post#1. Please post the current version.
    I can't suggest fixes because my version does not compile.
    If you don't understand my response, don't ignore it, ask a question.

  6. #26
    snowhite is offline Member
    Join Date
    Apr 2012
    Posts
    23
    Rep Power
    0

    Default Re: java networking problem

    forget it...i dont get wht ur trying to tell

  7. #27
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,457
    Rep Power
    20

    Default Re: java networking problem

    Quote Originally Posted by snowhite View Post
    forget it...i dont get wht ur trying to tell
    This is a programming forum, not SMS chat. Please spell words in full.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  8. #28
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,902
    Rep Power
    25

    Default Re: java networking problem

    Ok, if you can won't post the current version of the code that you have, then I done.

    Good luck.
    If you don't understand my response, don't ignore it, ask a question.

  9. #29
    snowhite is offline Member
    Join Date
    Apr 2012
    Posts
    23
    Rep Power
    0

    Default Re: java networking problem

    2 things ...plz explain to me clearly wht to do....

    number 1: what is the meaning of "current version of the code..?"

    number 2: what steps should i take to get the "current version of the code...?"


    regarding compilation and execution of my program in my computer-----

    number 1: there are no compilation errors coming

    number 2: there are not runtime exceptions occurring...this means the program is running fine...

    regarding the output

    number 1: frame is displayed...

    number 2: when i am trying to copy the file contents to the frame's text area......its not working...

    i need a solution for number 2....

    thankyou...i appreciate it if you understand this...

  10. #30
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,902
    Rep Power
    25

    Default Re: java networking problem

    By the current version I mean the version that you are using today. The code posted in post#1 does NOT compile without errors. To test the code I need a version of the code that compiles without errors.
    Copy the version of the code that you are using today that you can compile without errors and and paste it here.
    If you don't understand my response, don't ignore it, ask a question.

  11. #31
    snowhite is offline Member
    Join Date
    Apr 2012
    Posts
    23
    Rep Power
    0

    Default Re: java networking problem

    but i have posted the current version only.....initially whichever program i have posted is the one without any errors

  12. #32
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,902
    Rep Power
    25

    Default Re: java networking problem

    Please post the code that you are now using. Is there a problem that you can not post the code that you are currently using?
    The posted code does not compile without errors.

    If you want any help, you should post the code. Otherwise you are wasting time.
    If you don't understand my response, don't ignore it, ask a question.

  13. #33
    snowhite is offline Member
    Join Date
    Apr 2012
    Posts
    23
    Rep Power
    0

    Default Re: java networking problem

    import java.io.IOException;
    import java.io.PrintStream;
    import java.net.ServerSocket;
    import java.net.Socket;

    import java.io.*;

    public class MultiThreadServer implements Runnable {
    Socket csocket;
    MultiThreadServer(Socket csocket) {
    this.csocket = csocket;
    }

    public static void main(String args[])
    throws Exception {
    ServerSocket ssock = new ServerSocket(1234);
    System.out.println("Listening");
    while (true) {
    Socket sock = ssock.accept();
    System.out.println("Connected");

    new Thread(new MultiThreadServer(sock)).start();

    }
    }
    public void run() {

    System.out.println("entered in run");
    try {

    System.out.println("entered in run try");

    byte[] mybytearray = new byte[1024];

    InputStream is = sock.getInputStream();

    File file = new File("D:/MyProject/src/Sumanth/WebServer/AnuFileServer/mani.txt");

    FileOutputStream fos = new FileOutputStream(file);

    BufferedOutputStream bos = new BufferedOutputStream(fos);

    int bytesread = is.read(mybytearray,0,bytesRead);

    bos.write(mybytearray,0,bytesread);

    System.out.println("bos object"+bos);

    bos.close();




    }
    catch (IOException e) {
    System.out.println(e);
    }
    }
    }




    //*********************this is client program**************


    import java.net.*;

    import java.lang.reflect.*;

    import java.lang.Class;

    import java.io.*;

    import java.awt.event.*;

    import java.awt.*;

    import java.util.*;



    import org.apache.commons.io.FileUtils;

    public class Client2Using extends Frame implements ActionListener{

    Button b1,b2,b3;Socket socket;

    TextArea t;

    TextField text;

    public Client2Using(){


    setLayout(new FlowLayout());


    b1 = new Button("start server");

    b2 = new Button("File Upload");

    b3 = new Button("Show File Contents");

    t = new TextArea(10,10);


    text = new TextField();

    this.add(text);



    b1.addActionListener(this);

    b3.addActionListener(this);


    add(t);
    add(b1);

    add(b2);

    add(b3);



    }


    public void actionPerformed(ActionEvent e){


    if(e.getSource()==b1){



    met();




    }

    if(e.getSource()==b3){


    met1();


    }



    }


    public void met(){


    System.out.println("gfskjdfgksdfgkfd");


    try{







    Socket socket = new Socket("localhost",1234);



    this.socket = socket;


    System.out.println("Server Started");




    }catch(Exception e){e.printStackTrace();}



    }


    public void met1(){

    try{


    File myfile = new File("D:/MyProject/src/Sumanth/WebServer/MyFrame.java");

    byte[] mybytearray = new byte[(int) myfile.length()];

    BufferedInputStream bis = new BufferedInputStream(new FileInputStream(myfile));

    bis.read(mybytearray,0,mybytearray.length);

    OutputStream os = socket.getOutputStream();

    os.write(mybytearray,0,mybytearray.length);

    os.flush();



    System.out.println("os object"+os);


    }catch(Exception e){e.printStackTrace();}



    }

    public static void main(String args[]){


    Client2Using f = new Client2Using();

    f.setVisible(true);

    f.setSize(100,100);

    }

    }

  14. #34
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,457
    Rep Power
    20

    Default Re: java networking problem

    Please see the first response in this thread.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  15. #35
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,902
    Rep Power
    25

    Default Re: java networking problem

    Here is an indication of the errors I get. I does you no good if I give you the specfics on these. YOU MUST get these errors to be able to fix this code and any other code you work on in the future.

    Running: D:\Java\jdk1.6.0_29\bin\javac.exe -Xlint MultiThreadServer.java

    MultiThreadServer.java:xx: cannot find symbol
    symbol : variable xxx
    location: class MultiThreadServer

    MultiThreadServer.java:xx: cannot find symbol
    symbol : variable xxxx
    location: class MultiThreadServer
    2 errors


    3 error(s)
    Last edited by Norm; 05-02-2012 at 05:02 PM.
    If you don't understand my response, don't ignore it, ask a question.

  16. #36
    snowhite is offline Member
    Join Date
    Apr 2012
    Posts
    23
    Rep Power
    0

    Default Re: java networking problem

    mr norm ......" cannot find symbol " occurs when u dont set the classpath to the classes folder or when the path variable is not set properly....or sometimes when u dont import the packages properly....at first in ur computer plz check whether u have set the classpath and the path variable properly to the required java bin folders....set the classpath in environment variables.....

    what is variable xxx...?.i have not defined any variable xxx in my program..? which variable was it...?..and plz compile and run the client program seperately and the server program seperately..that is in one text document type copy the client program...in another text document copy the server program...

    plz mention the variable name....compiler only recognises the packages and the variables only when it knows how to communicate with the java software....plz make sure u have installed the java software properly and set the path variable....

    how can i fix errors when they r not occuring in my computer...i am trying to explain the same thing to u since days ..that the above program which i have posted works fine in my computer...it compiles ....without any errors...

  17. #37
    snowhite is offline Member
    Join Date
    Apr 2012
    Posts
    23
    Rep Power
    0

    Default Re: java networking problem

    classnotfoundexception occurs when classpath is not set properly...cannot find symbol occurs when the compiler is not able to communicate with the required java files or jar files....plz make sure u have set the path and the classpath variable properly...

  18. #38
    snowhite is offline Member
    Join Date
    Apr 2012
    Posts
    23
    Rep Power
    0

    Default Re: java networking problem

    the problem is in ur computer...not mine

  19. #39
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,902
    Rep Power
    25

    Default Re: java networking problem

    You must find a better compiler that finds the errors.

    I do not believe that you can compile the code you posted without errors.
    If you don't understand my response, don't ignore it, ask a question.

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Networking with java
    By munny in forum Networking
    Replies: 8
    Last Post: 11-20-2011, 05:30 AM
  2. New to networking in java...
    By jigglywiggly in forum New To Java
    Replies: 4
    Last Post: 05-25-2010, 09:10 AM
  3. networking problem
    By anurupr in forum Networking
    Replies: 0
    Last Post: 03-15-2010, 04:53 PM
  4. Java networking.
    By tim in forum New To Java
    Replies: 7
    Last Post: 07-16-2009, 11:43 PM
  5. Networking Problem
    By Ambuscade in forum Networking
    Replies: 21
    Last Post: 11-05-2008, 04:12 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •