Re:Help with code for server client

Hi i am struggling to adapt code for UDPServer and client programs.
how can i adapt the following server code to add a message before replying to the client?
import java.net.*;
import java.io.*;
public class UDPServer2{
public static void main(String args[]){
     DatagramSocket aSocket = null;
          try{
          aSocket = new DatagramSocket(9000);
                         // create socket at agreed port
               byte[] buffer = new byte[1000];
               while(true){
                    DatagramPacket request = new DatagramPacket(buffer, buffer.length);
                    aSocket.receive(request);
               DatagramPacket reply = new DatagramPacket(request.getData(), request.getLength(),
                    request.getAddress(), request.getPort());
                         aSocket.send(reply);
          }catch (SocketException e){System.out.println("Socket: " + e.getMessage());
          }catch (IOException e) {System.out.println("IO: " + e.getMessage());
          }finally {if(aSocket != null) aSocket.close();}
any help would be much appreciated i have tried altering the aSocket.send(reply) line but to no avail.
thank you in advance

Hi i am struggling to adapt code for UDPServer and
client programs.
how can i adapt the following server code to add a
message before replying to the client?What do you want to add before replying to the client?

Similar Messages

  • Help with code for inserting horizontal scroll bar in photo gallery in Business Catalyst site?

    Hi,
    I am using Business Catalyst and Dreamweaver to create a trial site.
    I am not sure if this is the correct forum to post this request but anyway I have inserted a photo gallery module at the bottom of the sidebar in the homepage of my test site.
    Can anyone advise on whether jquery or any other code can be inserted into the page or module code that will replace the "next" hyperlink below the first 4 photos with a horizontal scroll bar at bottom of the gallery so users can just scroll through all 12 images ?
    Kind Regards, Matt.
    http://craftime-bs6.businesscatalyst.com/

    Alyssa,
    Have you tried putting this rule back as it was originally:
    /* Submenu that is showing with class designation MenuBarSubmenuVisible, we set left to auto so it comes onto the screen below its parent menu item */
    ul.MenuBarHorizontal ul.MenuBarSubmenuVisible
        left: auto; /*was 9px*/
        color: #EF9CCF;
        background-color: #FFF;
    That is, changing your 9px back to auto.
    And giving  us a link (as you did) is much better than printing out the code for us! Thanks!
    Beth

  • Help with code for score-keeping with dynamic text box

    Hi All,
    I'm having an actionscript 2.0 problem with keeping score.
    I have a dynamic text box with a variable called score.
    I have the following action code for that variable:
    _root.score = 0;
    For the correct answer button I have this action:
    _root.score = Number (score) +10;
    This works fine to increase the score by 10 for each correct answer.
    The problem is that I can't get an if statement to work for when the score reaches 150 to gotoAndPlay a certain frame. I've tried various syntax, I've tried it on the action for a button and an action for the timeline with: 
    onRelease = function () {
    (My learning game is set up to allow for users to answer up to four extra questions to reach the score of 150).
    Nothing works. Any suggestions please?
    Pam

    Below is a link to a small sample file.  See if you can find anything different between your file and the one linked that might cause yours to not work as desired.
    http://www.nedwebs.com/Flash/AS2_score_sample.fla

  • Urgent-Need help with code for Master data enhancement

    hi Experts,
    I have appended YMFRGR field(Table MARC) to 0MAT_PLANT_ATTR datasource.
    The key fields in the MARC table are MATNR and WERKS.Can anybody help with the user exit to populate this field,as am pretty new to ABAP.
    Thanks in advance

    Hi,
    go through this link which has the similar problem:
    https://forums.sdn.sap.com/click.jspa?searchID=1331543&messageID=2794783
    hope it helps.
    Thanks,
    Amith

  • Help with code for System.currentTimeMillis()

    I need to time how long it takes to do various sorts (selection sort, insertion sort) and was instructed to use System.currentTimeMillis() to accomplish this. Please take a look at the code below and let me know what is wrong. I can get the file to complile but it does not record the time it takes to run the sorts. I'm pretty sure my error is in the below section of code. In order to save space, I've only pasted the snippit of code for this particular function. Let me know if I need to paste more code. Thanks in advance.
    case 5:
                             System.out.print("Enter the value to look for: ");
         val = scan.nextInt();
         time1 = System.currentTimeMillis();
         loc = list.linearSearch(val);
         time2 = System.currentTimeMillis();
                             totalTime = time1 - time2;
                             System.out.println("Total time for this search is: " + totalTime);
         if (loc != -1)
                                  System.out.println("Found at location " + loc);
         else
                                  System.out.println("Not in list");
         break;
                             

    It could be that it isn't actually doing anything
    though. Either because the data is poorly choosen or
    because it isn't actually sorting due to a bug.The name of the method being timed is "linearSearch". That's a really poor name for a method that is supposed to be sorting. But from other aspects of the code I would guess that it is doing a linear search of an array, looking for a particular integer. Even if the integer isn't in the array, comparing 20,000 integers is a trivial exercise.
    People don't realize just how long a millisecond is for a computer. If you have a 1 GB processor (not uncommon these days) then you can do one billion (one thousand million) operations per second. That's one million operations per millisecond. So chances are, even realizing that there's a whole lot of overhead in a high-level language, the OP's code runs in less than 1 millisecond.

  • Need help with code for adding dates to form

    Hello forum goers
    I'm new to making forms and figured out how to auto add the date, however I need the form to change the date for every copy made.
    For example today is 06/08/2012 if I print 10 copies of the form it will output 10 pages ranging from 06/08/2012 to 06/17/2012. If code exists to do this I would be very gratefull to whoever helps, I also wouldn't mind if that is not possible for manually inputing the start / end dates.
    Currently I print 15-30 copies of the form and hand write each of the dates but I'm just getting to busy to do that. I also cannot print one a day it must be in batches.
    Thanks in advanced.

    What you are asking for is more complex than just setting the current date. Each time the form prints it has to know that it has to change the date. I would suggest doing this.
    First, setup a document level script to set the date to the current date. I suspect that you have already done this?
    Next, Create a "DidPrint" document action to increment the date.  To do this the script will need to scan the current text value of the date, add one day to it, and then reformat it.  You'll find information on this type of scripting in these articles:
    http://acrobatusers.com/tutorials/working-with-date-and-time-in-acrobat-javascr
    ipt
    http://acrobatusers.com/tutorials/working-with-date-and-time-in-acrobat-javascr
    ipt-part-2
    http://acrobatusers.com/tutorials/working-with-date-and-time-in-acrobat-javascr
    ipt-part-3
    Since the increment happenes in the Did Print you will need to print each copy individually. If you enter 10 copies in the print dialog it won't work. You have to print one at a time.  You can automate this activity with a console script.
    One of the advantages of incrementing in the DidPrint is that you can also manually enter a date and it will increment from there.
    Thom Parker
    The source for PDF Scripting Info
    pdfscripting.com
    The Acrobat JavaScript Reference, Use it Early and Often
    Then most important JavaScript Development tool in Acrobat
    The Console Window (Video tutorial)
    The Console Window(article)
    Having trouble, Why Doesn't my Script Work?

  • Help with code for Selection Box

    Hi All,
    I have written the below code in the Data Section of the infoset
    BEGIN OF IT_TYP-SALE OCCURS 0,
      LTEXT TYPE TVKOT-VTEXT,
    END OF IT_TYP-SALE.
    DATA: IT_RETURN LIKE DDSHRETVAL OCCURS 0 WITH HEADER LINE.
    The code works fine, but when the user presses F4 in the box which opens the header displayed is 'Name' which is the header for TVKOT-VTEXT. I would like to know how i can define a custom header Eg: 'Company Name'.
    Hope my problem is clear, await assitance.
    Vivek

    Hi,
    Thanks for the inputs, what i really need is how i can define a custom text. As the header i want to display is not a standard field header. So in that case how should i declare?
    Note: The Company Name was only a example.
    Any suggestion on how i can have a custom name appearing as the header instead of the table field header?
    Edited by: Vivek on Jan 8, 2008 9:35 PM

  • Please help with code for a program

    Write a program which comutes the value of an investment over a 5 year period.The porgrm should display the value of an investment for each of the 5years were the initial investment and interest rate are to be specified by the user.It should compute and present value in the first year,compute and display value for the second year up to the last year(use a while or do...while loop).While there are more years to process ask the user for the next input,compute the value for the next year and output.

    jverd wrote:
    So what you're saying is that you're a lazy, stupid, unethical cheater and you want someone else to do your homework for you so that you can take credit you don't deserve and get a grade you didn't earn.
    Go to hell.But he's willing to pay big bucks (10 duke stars!) for this, so let's race to get those precious dukes.

  • Forum label for Server/Client

    Mac OS X Server posts frequently end up in the Mac OS X Client forum. Perhaps a link in the Client forum to the Server category could help, or labelling the Client 10.6, 10.5, 10.4, 10.3 and earlier forums "Client" so people don't mispost anything for Server could help prevent posts for Server ending up in Client?
    Or perhaps a Server category could be put together with the Mac OS X and related software?
    Or perhaps in the Mac OS X support pages, a link to Server category could be added?
    Just some suggestions.

    a brody,
    Except for rare exceptions the forum and category names match the actual product marketing name. The server forums are marked as server and we will happily move the occasional post that shows up in the client section when it occurs.
    -Eric W.

  • Help regarding applet for querying client's MAC?

    Please help with an applet and java code that uses Runtime.getRuntime().exec("ipconfig -all") and gets the client's machine MAC address?
    If any one already worked with applets for querying client mahchine MAC , please give me a solution.

    remus.dragos wrote:
    vasu.mtech wrote:
    I am giving an explanation where I want this:
    We have an application, where user will be given a specific machine(with one MAC) and have to login from there only. If he tries to login from different machine with same user id, we should throw an error message. That's concept. We know that this reduces/kills operatability of the user from different machines.
    But we shouldn't allow the user operating from diffrent machines.What happens if the admins NIC burns? And he gets a news one? He can't log in until you manually change his
    MAC in the database ???Database? That's not secure!
    It has to be hardcoded into the exe (guess what the kid's next question will be?).

  • Combo box and Check box..help with code please?

    Here is my problem...i have a list of check boxes and according to which one is checked, i need combo boxes to populate different choices.
    as an easy example im only using 2 check boxes and two combo boxes.
    the check boxes are named Choice 1or2 with export values of 1 and 2
    the Combo Boxes are named List A and List B..
    both containing options that say you checked box 1 and you checked box 2
    any help would be greatly appreciated

    Implode wrote:
    "Help with code please."
    In the future, please use a meaningful subject. Given that you're posting here, it's kind of a given that you're looking for help with the code. The whole point of the subject is to give people a high level idea of what KIND of help with what KIND of code you need, so they can decide if they're interested and qualified to help.
    Exception in thread "main" java.lang.NumberFormatException: For input string: "fgg"
         at java.lang.NumberFormatException.forInputString(Unknown Source)
         at java.lang.Integer.parseInt(Unknown Source)
         at java.lang.Integer.parseInt(Unknown Source)
         at assignment1.Game.Start(Game.java:120)
         at assignment1.RunGame.main(RunGame.java:18)This error message is telling you exactly what's wrong. At line 120 of Game.java, in the Start method (which should start with lowercase "s" to follow conventions, by the way), you're calling Integer.parseInt, but "fgg" is not a valid int.

  • Help with updates for CS6

    I need help installing latest updates for CS6.  I have Win 7 and have tried updating from the Help - Updates menu.  The error is:  U43M1D207.

    Thanks for your response.  I am in the United States in So. Arizona.
    Date: Fri, 5 Oct 2012 12:21:45 -0600
    From: [email protected]
    To: [email protected]
    Subject: Help with updates for CS6
    Re: Help with updates for CS6 created by Jeff A Wright in Downloading, Installing, Setting Up - View the full discussion
    Crunkle1 you are welcome to work directly with our support team for guided assistance.  If you go to http://www.adobe.com/ and select Help and Contact Us you should be given the option to contact our support team via telephone.  Which country/region are you in?
    Please note that the Adobe Forums do not accept email attachments. If you want to embed a screen image in your message please visit the thread in the forum to embed the image at http://forums.adobe.com/message/4752605#4752605
    Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/4752605#4752605
    To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/4752605#4752605. In the Actions box on the right, click the Stop Email Notifications link.
    Start a new discussion in Downloading, Installing, Setting Up by email or at Adobe Community
    For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746.

  • We have been having a problem with newsletters for a client. The newsletter works fine except if we add a button and/or link to the top zone on that newsletter it blows up ONLY ON iPhones!

    We have been having a problem with newsletters for a client.
    The newsletter works fine except if we add a button and/or link to the top zone on that newsletter it blows up ONLY ON iPhones!
    This happened last month too. It seems to be related to length of the newsletter too. It works on every device except iPhones - so weird.

    Hi, is anyone else experiencing i-phone only problems on email campaigns? not bashing Apple, just having issues where our newsletter are only having issues on iPhones

  • Help with business catalyst with muse for a client's website

    I created a site for a client using creative cloud muse, she got a business analyst account and added me as a user, but i am not able to upload the site straight from muse using publish .. what am i doing wrong?

    There is a workaround. It takes a little more work, but it is definitely worth it and will solve your problem. I subscribed and learned from tutorials on the www(.)trainsimple(.)com. They have a video series called "Muse CC Business Catalyst Integration" which was very helpful. The issue that everyone on here is referring to is covered in the 3 videos labelled, "Email Sign Up Checkbox", "Moving Muse Webforms to Business Catalyst" and "Email Marketing".
    Essentially, what you want to do is create a form in Business Catalyst, turn that form into a module, assign a tag to that module, then put the tag into Muse using Object > Insert HTML. This will solve Muse deleting the web forms everytime.

  • Help with Netscape enterprise server 6.1 error get_auth_user_ssl

    background: I'm not a web admin, I'm a perl coder just put into a place to recode some perl that is not up to standards. Any help would be appriciated, and if you can help solve this, I'd buy you your favorite 6 pack :)
    There is this server here Sun5.8 running NES 6.1. All the other servers run apache and aren't having any issues. This one runs NES 6.1 because the data on the server is very restricted to specific groups of people.
    Now, before I post for help with tuning this beast, I'd like to get rid of of these error msgs, as I think this is what's causing the slowness on the system. ( just set MaxProcs to 2. It was running just 1 process before)
    There are 2 virtual servers set up. foo.com and bar.com (I can't cut and paste across the systems, so I have to type everything by hand.
    after a child process admin shuts down, a new process starts up:
    warning (pid) in sytemname virtual server https-foo, urlhost foo.com does not match subject "system name" of certificate Server-Cert.
    bunch of infos: install new configuration, ready to accept...Java classpath...
    all normal
    Then paraphrasing
    Loading IWSSessionManager by default
    IWSSessionManager: max 1000
    {Address ...IOTimeout .. MinCGIStubs...CGIStubsTImeout..MaxCGIStubs  }
    directive ignored
    That's when all these
    security (PID): get_auth_user_ssl: unable to map cert to LDAP entry. Reason: No such object etc....
    The CN it's saying that no such object exists, does exist.
    Once it spits out about 10 of these, the page loads or you get
    catastrophe (PID): Server crash detected.
    At this point, a new session starts up and the user then gets in, or they all start complaining.

    plugins (I'm assuming you mean the Init fn's from magnus.conf.. (I'm a newb to all this. LOL )
    I hope I don't have any spelling errors here, I have to type it all. The PC i'm on to access the internet is on a different network than the server is on, so no copy and paste..
    Init fn="perf-int" enable=true
    Init fn="define-perf-bucket" name="cgi-bucket" description="CGI Stats"
    Init fn="load-types" mime-types="mime.types"
    Init fn="load-modules" shlib="/usr/netscape/servers/bin/https/lib/libNSServletPlugin.so" funcs="NSServletEarlyInit,NSServletLateInit,NSServletNameTrans,NSServletService" shlibs_flags="(global|now)"
    Init fn="NSServletEarlyInit" EarlyInit="yes"
    Init fn="NSServletLateInit" LateInit="yes"
    Init funcs="shtml_init,shtml_send" shlib="/usr/netscape/servers/bin/https/lib/libShtml.so" NativeThread="no" fn="load-modules"
    Init LateInit="yes" fn="shtml_init"
    Init fn="flex-init" access="$accesslog" format.access="%Ses->client.ip% etc, etc, etc lots more to type... I can type it all if you need it.
    Init fn="stats-init" profiling="on"
    No core file(s)
    ./start -version
    Netscape Communications
    Netscape-Enterprise/6.1SP4 B07/07/2003 02:38

Maybe you are looking for

  • Wrong display of No. of days worked in Payslip for mid-month joining

    Dear Experts, We use PE51, form editor for payslip for indian payrol. Our issue is when an employee joins mid of the month or say 4th of any month, still in payslip it shows no. of working days as 30/31 days instead of actual days worked. But pay res

  • Why doesn't my iPhone 5 work?

    Hello Apple Community, I have a GSM  iPhone 5, and this phone has recently taken a brash impact with the ground from an incident, and it has caused my phone to stop working (there no crackes or sever knicks on the phone however). By not working i mea

  • Best BB PB App for TV ?

    whats the best app for tv on blackberry playbook ?? because on my android phone i have a TV app called TVCatchup and its really good for watching TV is there an equivalant for the BB PB?

  • PIXMA Pro9000 Mark II print issue with Mac

    I am having issues printing photos.  The picture comes out really dark, and the color is not right.  I am using the latest version of Mac.  How can I fix this issue?

  • Error after migration to Crystal Reports 12 for existing reports

    Hi, We had reports written using Crystal Reports Version 8.5. These reports were not modified for a long time. Recently, we had migrated to Crystal Reports 12 (2008). Some of the these existing reports were modified using the Crystal Reports 2008 des