Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Trying to make set and get Fuction for a Socket.... but i get null in get method

  1. #1
    Junior Member
    Join Date
    Jan 2013
    Location
    Mumbai, India
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Angry Trying to make set and get Fuction for a Socket.... but i get null in get method

    Here is Some sample Code!!

    public static Socket sock=new Socket();
    public static Socket recvsock;
    public static SocketInfo ipinfo;



    public static void setSocket(Socket socket)
    {

    sock=socket;
    Log.d(handsOn.Tag, ""+sock.getInetAddress());//Dis log fuction is bcoz i m coding for n Android .. same as System.out.println()
    }
    public static Socket getSocket()
    {
    Log.d(handsOn.Tag, "sock"+sock.getInetAddress());
    return sock;
    }


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,162
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: Trying to make set and get Fuction for a Socket.... but i get null in get method

    Please post the full text of the error message you are having problems with and the code that is causing it.

    Please edit your post and wrap your code with
    [code=java]
    <YOUR CODE HERE>
    [/code]
    to get highlighting and preserve formatting.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. Java Class : How do I set up a toString method for arrays?
    By red7 in forum What's Wrong With My Code?
    Replies: 10
    Last Post: May 11th, 2012, 05:47 PM
  2. How to make set to allow duplicate values... Please help me!!!
    By JavaKiddo in forum Collections and Generics
    Replies: 9
    Last Post: January 4th, 2012, 08:22 AM
  3. Should validation code exist in set methods or in a validate method
    By mydarkpassenger in forum Java Theory & Questions
    Replies: 4
    Last Post: May 27th, 2010, 08:37 AM
  4. How do you set an object in array to null value?
    By Arius in forum What's Wrong With My Code?
    Replies: 5
    Last Post: January 25th, 2010, 03:50 AM
  5. Post variable set to non-null vlaues
    By ss7 in forum What's Wrong With My Code?
    Replies: 3
    Last Post: November 1st, 2009, 12:04 PM