curlyfries1999's Profile User Rating: -----

Reputation: 0 Apprentice
Group:
Active Members
Active Posts:
111 (0.1 per day)
Joined:
22-December 11
Profile Views:
850
Last Active:
User is offline Jun 05 2013 09:59 AM
Currently:
Offline

Previous Fields

Country:
GB
OS Preference:
Windows
Favorite Browser:
FireFox
Favorite Processor:
Intel
Favorite Gaming Platform:
Playstation
Your Car:
Who Cares
Dream Kudos:
0
Icon   curlyfries1999 has not set their status

Posts I've Made

  1. In Topic: Game developer help incitment

    Posted 9 May 2013

    I would just like to say, the main thing we want somebody to do is clean up the code. I think we have written it well so far but I would like to see what somebody else thinks.

    Thanks, Curly :D
  2. In Topic: Send message to all connected clients

    Posted 2 Mar 2013

    View PostRJCoder8989, on 02 March 2013 - 07:41 AM, said:

    View PostRJCoder8989, on 02 March 2013 - 12:33 AM, said:

    View Postcurlyfries1999, on 17 February 2013 - 12:04 PM, said:

    View Postg00se, on 17 February 2013 - 11:59 AM, said:

    I am getting the same problem when sending message from server it is not going to all clients. Please help


    :D/>/>/>
    import java.io.*;
    import java.net.*;
    
    
    public class ServerChat implements Runnable
    {
        static ServerSocket server;
        static Socket client;
    
        static class Read implements Runnable
        {
            public void run()
            {
                try
                {
                    InputStream istream=client.getInputStream();
                    InputStreamReader isreader=new InputStreamReader(istream);
                    BufferedReader breader=new BufferedReader(isreader);
                    String reader;
                    while((reader=breader.readLine())!=null)
                    {
                        System.out.println("From Client:"+reader);
                    }
                    breader.close();
                    istream.close();
                    isreader.close();
                    client.close();
                }
                catch(Exception read)
                {
                    System.out.println(read);
                }
            }
        }
    
        static class Write implements Runnable
        {
                public void run()
                {
                    try
                    {
                        OutputStream opstream=client.getOutputStream();
                        PrintStream pstream=new PrintStream(opstream);
                        BufferedReader breader1=new BufferedReader(new InputStreamReader(System.in));
                        String write;
                        while(!(write=breader1.readLine()).equals("exit"))
                        {
                            pstream.println(write);
                        }
                        breader1.close();
                        opstream.close();
                        pstream.close();
                        client.close();
                    }
                    catch(Exception write)
                    {
                        System.out.println(write);
                    }
                }
        }
    
        int n=1;
        public void run()
        {
            for(;;)/>/>/>
            {
                try
                {
                    Read read=new Read();
                    Write write=new Write();
                    client=server.accept();
                    System.out.println("Connection established from client:"+n);
                    Thread t1=new Thread(read);
                    Thread t2=new Thread(write);
                    t1.start();
                    t2.start();
                }
                catch(Exception e)
                {
                    System.out.println(e);
                }
              n++;
            }
        }
    
        public static void main(String[] args)throws Exception
        {
            ServerChat chat=new ServerChat();
            server=new ServerSocket(6666);
            System.out.println("Waiting for connection");
            Thread clientthread=new Thread(chat);
            Thread clientthread1=new Thread(chat);
            clientthread.start();
            clientthread1.start();
        }
    }
    
    
    


    Download my project from GitHub: https://github.com/c...ab=repositories
    I think I have fixed the problem. The client is the repository named Game.

My Information

Member Title:
D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:
Years Programming:
1
Programming Languages:
VB.NET, C#

Contact Information

E-mail:
Click here to e-mail me

Friends

curlyfries1999 hasn't added any friends yet.

Comments

curlyfries1999 has no profile comments yet. Why not say hello?