Getting the IP address and port number and placing it in a window

Hi Everyone,
I have written the code which gives the system time in a window. But I need also to have the Internet address and the port number of the client in the window. the TimeserverRF considers incoming DatagramPackets as a request for the current time, if the client wishes to receive the current time from TimeserverRF, it has only has to send a DatagramPacket to TimeserverRF.
I am not sure how to do this writing DatagramPackets .
I have the TimeClient class application. Timeclient should send the Internet address and the port on which it is running.
Do You have any ideas.
// the code for system time.
import javax.swing.*;
public class Window1 {
public static void main(String[] args) {
JFrame win = new JFrame("TimeServer running on port 9999");
JTextArea tA = new JTextArea(1, 30);
win.getContentPane().add(tA);
win.pack();
win.setVisible(true);
String s1; // initialise variables
TimeData t1; // TimeData object initalise to t1 variable
t1 = new TimeData(System.currentTimeMillis()); // start of loop body
s1 = t1.toTimeString(); // system time held sring s1
tA.append("Sent "); tA.append(s1); // Prints statement and time in Frame
}

Study this networking tutorial and then, if you have a specific question, create a new post with it.
http://java.sun.com/docs/books/tutorial/networking/index.html

Similar Messages

  • How to get the service address from service address number

    Hi, IS-U Gurus:
    I got the service address number by passing business partner number to  BAPI 'BAPI_ISUPARTNER_GETDETAIL'
    On return table of "bapiisubpa", the first field is service number, but what we need is service address,
    How can I get the service address from service number ?
    Thanks in advance.
    Liang
    Edited by: Liang Ji on Apr 27, 2009 6:57 PM

    hi
    are u looking for business partner address?
    if so u can ref table but020, get its bp no. and then refer table but000 for its address.
    Regards,
    Sumedha

  • I've been using my cell phone number to imessage from my ipad for a while now, but yesterday I got signed out of I message and when I signed back in, I didn't get the option to use my number, only my email adress. How can I fix that?

    I've been using my cell phone number to imessage from my ipad for a while now, but yesterday I got signed out of I message and when I signed back in, I didn't get the option to use my number, only my email adress. How can I fix that?

    Hey bill.rizzo2,
    Thanks for the question. I understand your phone number is missing on your iPad as an option for iMessage. The following article provides steps to resolve this issue:
    iOS and OS X: Link your phone number and Apple ID for use with FaceTime and iMessage
    http://support.apple.com/kb/HT5538
    Phone number missing on iPad or iPod touch
    If your phone number isn't listed on an iPod touch or iPad, follow these steps:
    1. Update to the latest version of iOS.
    2. Verify that you're using the same Apple ID that you're using on your iPhone.
    3. On your iPad or iPod touch, sign out of your Apple ID in the following locations:
        - Settings > Messages > Send & Receive. Tap your Apple ID, then tap Sign Out.
        - Settings > FaceTime. Tap your Apple ID, then tap Sign Out.
    4. Sign in to your Apple ID with FaceTime and iMessage.
    If your phone number still isn't listed, follow these steps:
    1. Sign out of your Apple ID on all iOS devices, including your iPhone, in the following locations:
        - Settings > Messages > Send & Receive. Tap your Apple ID, then tap Sign Out.
        - Settings > FaceTime. Tap your Apple ID, then tap Sign Out.
    2. Sign in to your Apple ID on your iPhone.
    3. When activation is complete, your Apple ID and all verified email addresses should be visible in Settings > Messages > Receive At and Settings > FaceTime.
    4. Sign in to your Apple ID on your other iOS devices.
    Thanks,
    Matt M.

  • I just updated my 3gs to the latest iOS 5 update and now I am unable to text certain numbers.  I keep getting the error code 1121611611 invalid number, even though the number I have in my contacts is a 10 digit number.  Any suggestions on fixing this?

    I just updated my 3gs to the latest iOS 5 update and now I am unable to text certain numbers.  I keep getting the error code 1121611611 invalid number, even though the number I have in my contacts is a 10 digit number.  Any suggestions on fixing this?

    PhotogYogi wrote:
    I Have the same issue on a brand new iPad mini 2. My battery is only lasting up to 5 hours. I went on chat with Apple last night and they said my battery is fine and its a Safari issue. I'm literally losing 1% every 3-4 minutes. I tried recalibrating my battery, signing out of iCloud, shutting off all locations, turning off background app refresh, restoring network settings, restoring all, and finally restoring from iTunes with no luck. This is just awful. I got this iPad so I could use it on my long flight for a trip I have coming up, and unfortunately, it's not going to last that long, plus I'm concerned about how many times i will be recharging my battery because of this since battery's do have a life cycle dependent on the number of charges. This is frustrating and needs to be fixed ASAP and addressed by Apple.
    By the way, Apple told me to bring my device to the Apple Store because it's still under warranty. That's great and all, but I'm going to waste my time if there is no fix for this issue.
    Ok so you want Apple to address the problem, but yet you don't want to take it to them just in case they can't fix it? What if they can fix it? Complaining here certainly won't fix it.

  • SDK : how to get the server adress and port ?

    Almost everything is in the title, I'm look for code to get the server URL and port where the ME is running ;o)
    There should be some standard API I guess.
    Thanks
    Regards

    Hi,
    In the code that I write I usually have access to the HTTP Request Object.
    String serverName = request.getServerName();
    String serverPort = request.getServerPort();
    Then I just do a compare on the returned value to see if I am on our Test or Production server.
    if(request.getServerName().indexOf("prodservername") >= 0)
      // PRODUCTION CODE HERE
    else
      // TEST CODE HERE
    Hope this helps,
    Mike

  • How to allocate memory and to get the start address

    im just trying to allocate a memory of 8MB and to get the start address of that mem,  by getting the address i will access that memory by dll function..  so i want to know how to allocate the memory and to get the address.. any one knows then pls tell me

    duplicate post
    Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
    If you don't hate time zones, you're not a real programmer.
    "You are what you don't automate"
    Inplaceness is synonymous with insidiousness

  • Changing the multicast Address and Port giving error

    I am using Coherence 3.3.1 jar files (Coherence.jar and tangosol.jar) in my local application. But when I try to change the multicast Address and Port in tangosole-coherence.xml(in Coherence.jar) then it is giving this error -
    "This member could not join the cluster because of an incompatibility between the cluster protocol used by this member and the one being used by the rest of the cluster. This is most likely caused by a Coherence version mismatch, or by mismatched protocol filters (e.g. compression, or encryption)"
    If i am using unique IP and Port then how can it be in a Cluster as this error stating. Please reply ASAP.

    Hi,
    There is a good chance that there is already the IP and port is being used by another cluster (which uses different versions of jars or configurations) and hence, when you are starting your cluster, throwing the error.
    Can you double check if another cluster is already using it or not ?
    Thanks,
    Amit

  • TS1702 When I try and use the Kindle app on my touch it keeps telling me to register the kindle. I register it using the account and password I used to get the app but it tells me there is no customer found for the email address and password. help

    When I try and use the Kindle app on my touch it keeps telling me to register the kindle. I register it using the account and password I used to get the app but it tells me there is no customer found for the email address and password. help

    No, it is asking you to register with your Amazon user id and password. Your Apple ID won't work.

  • I got an unused Adobe After effects CS6 from an ebay seller.He said the disc was cracked and sent me the 24 digit number key.Do I still need the disc to get the program?And where do i input the 24 digit key?Also do I have to sign up for CC I can't afford

    I got an unused Adobe After effects CS6 from an ebay seller.He said the disc was cracked and sent me the 24 digit number key.Do I still need the disc to get the program?And where do i input the 24 digit key?Also do I have to sign up for CC I can't afford that monthly charge.

    You can download from the page linked below:
    CS6 - http://helpx.adobe.com/x-productkb/policy-pricing/cs6-product-downloads.html

  • When I open the safari i go to facebook. now i get a weird address and have to go to bookmarks to get facebook

    when I open mymac book pro i click on safari and it goes straight to facebook. but for some reason now when i open safari i get a strange address and have to go to bookmarks to find facebook. anyone have a clue

    I tried to edit my previous post, but the system did not store my edits and no longer offers an 'Edit' button. The following is my revised post:
    I am also using Safari 5.1.7. By choosing the 'Privacy' tab in Preferences and then clicking on the 'Details' button, I have accessed a list of all the domains that are currently storing cookies in my browser.
    However, I'm unable to view the individual cookies or their contents by clicking or double-clicking on a given domain name in the list. So, how does one view an individual cookie and its content in Safari?
    By comparison, when I view the list of all domains storing cookies in Google Chrome's Preferences (Settings/ Privacy/ Content settings.../ All cookies and site data...), I'm able to view all individual cookies for a given domain by clicking (once) on that domain name in the list. (One domain, for example, had 9 separate cookies.) Then, I can view the full content of each cookie by clicking on a button bearing that cookie's name. For example, the content within each cookie displays such information as:
    'Name' (often a Session ID), 'Content' (a string of characters), 'Domain' (including subdomain, if applicable), 'Path' (generally root level, /), 'Send for' (when cookie should be invoked), 'Accessible to script' (yes or no), 'Created' (date), and 'Expires' (date). I find that some of this data can be enlightening -- such as when a site is storing affiliate codes in a cookie, and who the affiliate is. If I wish, I can delete an individual cookie (out of multiples) for a single domain, without necessarily deleting ALL the cookies for that domain.
    Safari does not seem to have similar capabilities, which puzzles me. That's a big shortcoming, IMO.  :-(

  • It used to be that when I created a pdf from a word or publisher document, hyperlinks worked fine. Now I cannot get them to work unless the text displayed for the link is the complete address and it all appears on one line. Why?

    it used to be that when I created a pdf from a word or publisher document, hyperlinks worked fine. Now I cannot get them to work unless the text displayed for the link is the complete address and it all appears on one line. Why?

    You can print to the Adobe PDF printer, but that only creates links that Acrobat or Reader recognize as such. That is the reason for needing the entire URL on one line. It is not actually an embedded link, but one created by Acrobat on the fly. With OFFICE 2013 you have two choices: 1. create the PDF with the print to Adobe PDF and then add the links in Acrobat so that they are complete or 2. I think the WORD save as PDF or XPS will create the PDF with links, but not sure. If so, that would be the quickest solution for you, but be aware of potential problems with the MS plugin.
    Of course, the third option is to upgrade to XI which can be done with AA 9. You will probably not be eligible for a for an upgrade to whatever the next version will be.

  • I have an Imac running snow leopard and have recently installed a cannon i-sensys lbp7750Cdn printer since then I can't get the printer working and the air port has lost the DNS servers; if it ever had them!!! but it dose not look happy. Can any one help

    I have an Imac running snow leopard and have recently installed a cannon i-sensys lbp7750Cdn printer since then I can't get the printer working and the air port has lost the DNS servers; if it ever had them!!! but it dose not look happy and it is telling me so. Can any one help please?

    Snow Leopard breaks quite a few drivers - my Canon exhibited the same problem.
    I eventually found updated drivers on the Canon website. You can try that with the HP, but if the all-in-one is more than a year or so old, don't hold your breath.
    You can also try Software Update to see if it will offer new drivers, or failing that go to the Support Downloads site and search for HP updates.
    In fact there's a new one for HP at the top of the list just now.
    You may not necessarily want the latest one, though - check the specs to see if your model is covered; if not, search for the previous update etc.

  • MDT boot image and when we try to PXE boot it won't get the IP Address.

    We created a custom MDT boot image and when we try to PXE boot it won't get the IP Address.
    I press F8 and type IPCONFIG we get Windows IP Configuration. We are using  vmxnet3 network adapter. 
    I think I need to inject 32-bit  vmxnet3 driver to the custom MDT boot image which is 32-bit.
    We are using it to deploy Windows Server 2008 R2 with SP1 operating System.
    Can I just use the 32-bit custom MDT boot image or do I need to use 64-bit Custom MDT Boot Image?
    Also Is there a blog on how to inject  vmxnet3 driver to boot image?

    You can try this:
    http://mwesterink.wordpress.com/2013/12/03/configmgr-2012-obtaining-vmxnet3-nic-drivers-for-vmware-virtual-machines/
    Honestly, your best bet is to use a different adapter (E1000). I personally have had no luck getting the vmxnet3 driver to work properly in WinPE. It's either really, really slow or it simply doesn't load at all.

  • HT4993 I just installed my email accounts and I can receive, but I can't send.  I get the message "address rejected by the server."

    Hello,
    Just got my first iPhone, (the 4s and installed my email accounts, but wonder if I've done something wrong.  I have verified all incoming and outgoing servers, user names and passwords and they are all correct, but while I can receive email, I can't seem to send.  I keep getting the message "address rejected by server."  Can anyone help?  Thank you all for your time...

    You have to go through the out-going server entries again. Consult with your e-mail provider.

  • I cant get the letter A and number 1 to work on my ipod  touch screen can you help me

    i cant get the letter A and nimber 1 to work on my touch screen on my ipod to work.

    Try the stand fixes, one at a time:
    - Reset:
    Reset iPod touch:  Press and hold the On/Off Sleep/Wake button and the Home
    button at the same time for at least ten seconds, until the Apple logo appears.
    - Restore the iPod from backup
    - Restore the iPod to factory defaults/new iPod.

Maybe you are looking for

  • How to bundle java help class into jar file ?

    Hi, all, I have some package in my project, with which I have a java help jar file as classpath, when I run my project, I need the jh.jar file in directory /jar/jh.jar. Now, I bundled all my class packages into a jar file, my.jar, together with the /

  • Creating a BP in CRM through LSMW using IDOC

    I am trying to create a buss partner in crm through LSMW using IDOC: Message Type:  CRMXIF_PARTNER_SAVE_M Basic Type:       CRMXIF_PARTNER_SAVE_M02 I get an error: "No update is defined for BP role 000000". I am also filling IDENTIFICATIONCATEGORY: C

  • Need software that supports video in via USB. QT Pro/iMovie= firewire only

    my friend can upload video from his cam into his pc via the USB but i can't. All I have is Final Cut Pro, iMovie HD and QT7 Pro. They All want firewire. k, i could get a cable but i'd like to save the trip. anything out there? tnx

  • Drop of Cookie file in a Client's Computer

    Well... i m stuck in this problem from more than 3 months.. and hav'nt find the solution yet.. my query is regarding the "COOKIE SERVLET", i have read the API and read differnt examples. MY PROBLEM: 1) Firstly, i was trying to send a Cookie to a clie

  • Error 100 with adobe download assistance..

    Error 100 with adobe download assistance..unable to sign in to use the adobe acrobat software..i am not having any network issues..