Sockets driving me insane.HELP PLZ  stress..stress...stress

The problem I am havin is that the listener class i have to deal with connections will creates a new socket for each connection but it says it is using the same port as the listening ServerSocket is in the case 4444. Here is the code for my Listener. Any help is greatly appreciated.
import java.io.*;
import java.net.*;
import java.util.*;
public class Listener implements Runnable {
  public void run () {
  try{
  listen();
}catch(Exception e){
System.out.println("Error in listener:"+e );
  public static void listen() throws IOException{
    int port = 4444;
    ServerSocket server = new ServerSocket (port);
    try{
    System.out.println("Listening...");
         while (true) {
         System.out.println("Listening....");
         Socket client = server.accept ();
         System.out.println ("Accepted from " + client.getInetAddress ());
         System.out.println("Using port:"+ client.getLocalPort());
         System.out.println("server Socket listening on port:"+server.getLocalPort());
         ChatHandler handler = new ChatHandler (client);
         handler.start ();
  }catch (IOException ex){
  System.out.println("Error in listener"+ex);
}

I am under the impression that this is not true a
port cannot be used by more than one socket as this
woould cause an exception of some kind, No ??
(Although saying that i do not get any exceptions )Sir,
No. And you have the proof. You cannot bind for listening on more than one socket. But once a socket is created it is unique even though the one port on the server side is shared among multiple sockets.
Sincerely,
Slappy

Similar Messages

  • How can I fix this ridiculous error code 13014? It's driving me insane!

    Ok, so I have seen a lot of people write about this error code and I feel like I have tried pretty much everything to stop it from happening but nothing works! Every couple of minutes or so when my 120gb iPod classic is plugged in the error message 13014 pops up, the constant bouncing of iTunes in the docking station is driving me insane. All the music syncs onto it fine though. I have my iPod on manually add music as I am using a different computer that doesn't have all the music from my iPod on it. I don't want to risk losing all the music on there, so I'm hoping restoring my iPod is not the only solution to this! Please help me before I murder iTunes. Thanks.

    Try removing their iTunes preferences file, which is located in the /username/Library/Preferences/ folder and is called "com.apple.iTunes.plist" ( rename or move it somewhere else)
    reboot the Mac
    then relaunching iTunes (it will create a new plist)
    Connect the iPod Classic directly to the Mac.

  • Can't connect using AEBS - driving me insane

    hi, hopefully someone out there can help!!
    i am trying to connect 2 computers to my AEBS. one is a mac mini and wired, the other is an ibook and wireless.
    both of them connect perfectly when i connect them with wires directly into the modem. however when i try and route the connection through the AEBS neither the wired or wireless connection works. this is despite the ibook telling me that it's connected to the internet via airport.
    i've called my ISP and talked to them, they gave me all the relevant settings but it hasn't made any difference. the problem seems to be in the AEBS itself.
    any thoughts? it's driving me insane...

    Hello thecornishman. Welcome to the Apple Discussions!
    Since your Macs are not able to access the Internet either wirelessly or by wire with the AEBSn, try the following, in order, checking for Internet access after each step, until resolved:
    1. If the modem has a reset switch, use it to reset the modem. Wait at least 5-10 minutes for the modem to initialize.
    2. Remove power from the modem. If it has a backup battery, remove this as well. Wait 5-10 minutes. Replace the battery, and add power back to the modem.
    3. Perform a complete power recycle of your network components as follows:
    Modem/Router Power Recycling - Quick
    o Power-off the modem, AEBSn, & computer(s); Wait at least 5 minutes.
    o Power-on the modem; Wait at least 5 minutes.
    o Power-on the AEBSn; Wait at least 5 minutes.
    o Power-on the computer(s)
    If this fails to get the modem to "recognize" the Internet router, then try the "Full" version.
    Modem/Router Power ReCycling - Full
    o Power-off the modem, AEBSn, & computer(s). (Wait at least 30 minutes. If possible, leave the modem off overnight.)
    o Power-on the modem; Wait at least 15 minutes.
    o Power-on the AEBSn; Wait at least 5 minutes.
    o Power-on the computer(s)
    4. Contact your ISP to have them perform a "modem reset."

  • Undead keychain driving me insane!

    Hey everybody.
    So, I'm on a Macbook 2,1 running 10.6.8 and for months now there's been a problem driving me insane.
    I've got a dual-band Airport Extreme station (one network is 2.4GHz b/g and the other is 5GHz n-only) and they're running on different SSIDs.
    Obviously I connect to the 5GHz one and bliss is to be had. The problem, however, is that the other one is in my keychain and is at the top of the priority list and I just cannot delete it.
    Whenever I delete it, it just pops back from nowhere after a while. (Sometimes immediately, sometimes within hours and sometimes after several days)
    I've checked several times to see if I've actually deleted it and whenever I check, it's nowhere to be found. Still I periodically find myself with really slow LAN transfer speeds and invariably when I check my Airport status, I'm connected to the slow network.
    Oh, and before anybody says anything: Keychain sync is (and has always been) disabled.

    Hi Payne, not sure if I can help you with this. Have you tried opening keychain access from the utilities folder? If not do so and open Preferences - First Aid and check 'set login keychain as default'. Your password should be the same as your login password if you need to authorise. I presume you are using Tiger if not you need to post more detail of OS etc.,
    HTH

  • Album Picks are Driving Me Insane

    Because I haven't upgraded from 3.2.4 or asked others for a workaround, I thought I post here before giving feedback.
    I'm not sure when the application engineers decided that if stacked images are added to an album the stack pick should automatically become an album pick that must be manually removed even after choosing a new stack pick, but it wasn't always this way. Of that I'm sure.
    This is driving me insane because I can't find a way to change the default, and I can't remove the album pick from multiple stacks simultaneously. 
    After I do the work to choose stack picks, I don't need the album to display a different image as the pick. In my workflow, this is a severe hinderance that costs me time and causes me to run the risk of overlooking acceptable images that I've already chosen to display as the pick.  If I need to use the album pick feature, I can make that decision without any help from the application.  The main thing that's kept me with Aperture is that I hate LR's DAM- especially the stack feature.
    Please tell me that this has been addressed in 3.4.  If this is the case, I might just find the time to update my huge library. 
    DLS

    I am still trying to wrap my head around this.  I think we may be seeing different behavior.  When I create a new Album from a selection in a Project that includes Stacks, the Album Pick is set, but it is always the same as the Stack Pick.  Yes?  This, to me, is what I would expect.  (From a computational point-of-view, there is no difference between designating the Stack Pick as the Album Pick, or not designating it, when the rule is that if there is no Album Pick designated, use the Stack Pick.)
    DLScreative wrote:
    ... at the very least, when I choose a new stack pick in the album, it should either replace the album pick or wipe it.
    Why?  The Album pick is a separate, Album-specific designation.  The Album pick is set to the Stack Pick when the Album is created, and remains so until you change one or the other.  You can change either in the Album.  I don't see why changing the Stack Pick in the Album should remove or replace the Album Pick.  If it's the Album Pick you want to change or remove, change it or remove it.  If you want to change the Stack Pick, you can do this either in the Project or in the Album.  But again, the Album Pick and the Stack Pick are independent once the Album is created.
    From a practical point of view, you can put the Album Pick and Stack Pick icons next to each other on the Toolbar (this might be the default) and simply click each if you want to set an Image as both the Album Pick and the Stack Pick.
    ... I should also be able to select all stacks and remove all album picks at once. 
    Agreed.  There should be a way to "reset" Album Picks to the current Stack Picks.
    I spent a good three hours going through and clearing album picks- that I didn't choose to create- one at a time, and I'm still coming across some that I missed.
    How did you remove them? 
    Here is one method:
    - Set the filter to "Stack picks only".  With an Album selected, this will show Album Picks where they exist.
    - Select the first Image with with an Album Pick badge showing, and click "Stacks➞Remove Album Pick".  Go to next Stack ("Stacks➞Next Stack" or whatever keyboard shortcut you have assigned).  At this point, you can either check for the Album Pick badge, and then remove the Album Pick, or you can click "Stacks" and see whether the menu choice is "Remove Album Pick" or "Set Album Pick".  Repeat for each Stack until you get to the last Stack in the Album.
    If you want to make the current Stack Picks the Album Picks, you can do this by creating a new Album from the Project.  Mark all Images in the Album (I use Flags), select the Project, select the marked Images, and create a new Album.  New Albums created from Projects set the Album Pick to be the Stack Pick.  Now you have two Albums containing the same Images.  One has all the old Album Picks.  In the other, the left-most Image in each Stack is both the Stack Pick and the Album Pick.  The result is that you have redesignated the Album Picks to be the Stack Picks.
    DLScreative wrote:
    BTW: The shortcut to add or remove an album pick is command+shift+\  (I've come to know it all too well) It's also available in the Stacks Menu under Make/Clear Album Pick. 
    Yes.  I was trying to differentiate between issuing commands (from a menu or the toolbar or a keyboard shortcut) and effecting a result by moving Images.  Afaik, Album-Pick-making must be done by command.  Stack-Pick-making can be done by moving an Image to the left-most position in a Stack.
    I'm still thinking through your workflow.  That this presents a rock in your stream means something isn't right.

  • Blurred images when I preview site in browser. This is driving me insane!

    Please please please can someone help me stop my images from appearing blurred when I preview site in browser. This is driving me insane!

    That's why...
    Here are a few tutorials for setting up your Muse site for retina display (HiDPI)
    HiDPI display support | Adobe Muse CC tutorials
    Adobe Muse CC 2014 - Retina Display Graphics | Top 8 New Features by MuseThemes.com - YouTube

  • Im new to the 5g ipod help plz

    will the ipod turn off if i leave it on pause? i know i have a really stupid question but help plz thx

    Yes.

  • My Apple TV is not working. On tv display, I'm getting unsupported signal. Check your device output. Can anyone help plz.

    My Apple TV is not working. On tv display, I'm getting a message 'unsupported signal. Check your device output. ' Can anyone help plz.

    connect it to a tv which support full hd and go into the settings and lower the resolution as much as possible and then connect it with your tv once more

  • I have just getting a new phone and I have forgot my password an Apple ID what I made new for the new phone now I cannot get on it because asking for id and password what should I do help plz thank u

    I have just getting a new phone and I have forgot my password an Apple ID what I made new for the new phone now I cannot get on it because asking for id and password what should I do help plz thank u

    Try
    https://iforgot.apple.com

  • I lost my phone and i got an unlocked 4s from my gf she used it before an its still connected to her icloud is there a way i can restore my icloud back up to replace hers without messing up the unlock also my latest backup isnt showing on my pc help plz!!

    i lost my phone and i got an unlocked 4s from my gf she used it before an its still connected to her icloud is there a way i can restore my icloud back up to replace hers without messing up the unlock also my latest backup isnt showing on my pc help plz!!

    Please please help me, if you know how.

  • I cant get voice over to work on my 4G shuffle it clicks off every time help plz

    i need help plz it wont work

    Hello,
    Welcome to Adobe Forums.
    Try uninstalling Adobe Flash Player from Flash Player uninstaller : http://helpx.adobe.com/flash-player/kb/uninstall-flash-player-mac-os.html#main_uninstall
    Try a clean installation using this KB : http://helpx.adobe.com/content/help/en/flash-player/kb/installation-problems-flash-player- mac.html
    Thanks,
    Vikram

  • I just got new iphone 4 but it tells me to restore the phone wen i plug in my computer.. then half way thru the restoring on the "firmwear" part it stops an says error "9?? wats the go there?? its driving me insane...

    i just got new iphone 4 but it tells me to restore the phone wen i plug in my computer.. then half way thru the restoring on the "firmwear" part it stops an says error "9?? wats the go there?? its driving me insane...

    Let's first define what "new" means. Was it purchased from Apple or your authorized carrier, and it came in a shrink wrapped box? Or is it only new to you, and you don't know its history?
    Assuming it truly is a new, never used phone, Error 9 means that the USB connection to the phone is intermittent. Do the following:
    Make sure you have the latest version of iTunes (10.4) - if not, download and install it from htp://www.apple.com/itunes
    Reboot your computer
    Disable your antivirus and firewall software
    Disconnect all USB devices except keyboard and mouse
    Connect the cable to a USB port directly on your computer, not to a hub; do not connect the other end to the phone yet (If your computer is a desktop or tower and has ports on both front and back us a port on the back)
    Launch iTunes
    Connect the phone to the other end of the cable
    If the phone is recognized in iTunes proceed with the Restore
    If the phone is NOT recognized by iTunes:
    Disconnect the cable from the phone (leave connected to the computer)
    Hold the HOME and SLEEP buttons until the screen goes blank, then IMMEDIATELY release the SLEEP button but continue holding the HOME button
    Connect the cable to the phone while holding the HOME button
    Wait for iTunes to recognize the phone, then release the HOME button (this may take several minutes of holding)
    If you still have a problem after these steps take the phone to Apple for exchange.

  • Help Plz.......!!!!its urgent

    hi nokia users
    flash lite on my 5530 only plays youtube videos,and when tried to play videos on other sites then it says flash player is required............do ui use any software that supports web videos...???
    help plz.....
    thanks in advance

    Falshplayer vedio cant acces in your device?

  • Help plz so my gf said she block me and we txt back to back but later on i sent her a messages and it said it was read so am I blocked  a

    help plz so my gf said she block me and we txt back to back but later on i sent her a messages and it said it was read so am I blocked 

    The proper way to close Firefox is through the File menu "Exit" or the equivalent with the Firefox button.
    More detail in item '''#38 Firefox already running '''
    of
    [http://dmcritchie.mvps.org/firefox/firefox-problems.htm#fx4interface Fix Firefox 4.0 toolbar user interface, problems (Make Firefox 4.0 look like 3.6) (#fx4interface)]
    Firefox already running, to properly shutdown Firefox when closing the last window use File → Exit/Quit (or Firefox button → Exit). Closing Firefox with the [X] in the upper right corner closes the window ("Ctrl+W") but that does not necessarily close Firefox if it has subtasks running. If you want to close and reopen Firefox use the "Restart" within Add-ons if you made a change requiring a restart, or install "[https://addons.mozilla.org/firefox/addon/restartless-restart/ Restartless Restart]" ("Ctrl+Alt+R") which will allow you to take Firefox down and restart without having to check the Windows Task Manager to see if Firefox first actually ended. [http://kb.mozillazine.org/Firefox_hangs Firefox hangs]

  • Help plz, i need back up my phone

    Help plz, i have iphone 4 i still have icloud  on my itunes and i need to update it to the new one but i dont want to lose any of my pictues of my kids im not sure if ive backed it up before if i have it would of been a long time ago plz help me thanks

    jennyspeedy* wrote:
    i dont want to lose any of my pictues of my kids im not sure if ive backed it up before if i have it would of been a long time ago plz help me thanks
    Then use the device as designed.  Copy the pictures off the device to the computer.  For any pictures that you desire to keep on the device, simply sync them via iTunes.
    Failure to copy the pictures off the device is only asking for problems.  If the device is ever lost/stolen or simply fails to work, without a backup they would be gone as well.

Maybe you are looking for

  • How can I use an A1082 monitor with my MacBook Pro?

    I received an apple A1082 monitor this past weekend from a friend and we couldn't, and still can't, figure out how it can be used with my MacBook Pro. I know that I need an adapter, but where does it get power from? Thanks in-advance. Richie.

  • External Monitor changing resolutions on Macbook

    I have seen several people ask this question, but I haven't found a suitable answer. I have a MacBook running 10.6.8 at school. I teach and move from room to room hooking up to different projectors and monitors. The set up is just very unstable. Desp

  • Using a Bind Variable in the FROM part of a SQL Statement?

    Hello Everyone, I have a problem, I am trying to run an SQL statement. However I need the FROM part of the SQL statement to be a bind variable. This is because the end user will need to select between 2 database views. I have tried this: select CON_I

  • To fix width of column or to achieve wordwrap in my column

    Hi friends, I have used Consumercollection Renderer in my Layout set. There are 4 columns called name, size, description and owner. Now the problem is that as the description of some folder increases the column width increases which is not desired. I

  • Bug in merging Pages document with Numbers

    I am a teacher, using a Numbers spreadsheet as a gradebook.  It has multiple sheets, and some sheets have multiple tables.  I created Pages documents that merge to the spreadsheet so that I can print "reports" for each student showing his/her grades.