Setting the traffic class in ServerSocket

Hi all,
in a ServerSocket I want to mark the dscp fields of the packets which are flowing through the client. I set the traffic class field as follows:
Socket inSock = serverSocket.accept();
inSock.setTrafficClass(64);
but this has a problem that the first packet sent by the inSock cannot be marked. This occurs because the first packet is sent in the accept() method, but I set the traffic class after this packet is sent. Then do you know any solution to set the tos as the default (set before the first packet) option for all sockets accepted by a ServerSocket.
I have some very workaround solutions such as implementing the SocketImpl and etc.But I want a KISS (Keep it simple stupid).
Thanks.

Yes thanks for your offer it would be good approach. but this arouses a new problem that my ServerSocket are created by a factory and I need to find a transparent solution in which for all ServerSocketFactory objects my solution works well. Let's see the example.
MyChannel(ServerSocketFactory f) {
ServerSocket serverSock = f.createServerSocket(param1, param2, ....);
Socket inSock = serverSock.accep();
In this case how can I morph the serverSock instance to my MySpecialServerSocket object for example.
Indeed I need only overriding accept method, and I need this to do for an instance not an object.
Do you know any way to do it?
For example we can do a thing as follows:
MyObject ob = new MyObject() {
public overridenMethod() {
};

Similar Messages

  • I already set the Main-Class:class parameter but still error... Help pls...

    I have an experimental project that starts with a main class called "mainConsole"
    I packed it using the NetBeans IDE 3.3.2 jar packager and also set the Main-Class: mainConsole parameter
    I still receive the error below when trying to execute the jar file.
    java.lang.NoClassDefFoundError: mainConsole
    Exception in thread "main"
    Can someone help me?
    Thanks in advance.

    Help me pleeeease!!

  • How to set the Model Class for a newly created Model Node ?

    Hello All,
      I am trying to map a Model node from SourceA to DestinationB.
      To do so, I created a model node for Destination B in the interface controller (set the isInputElement to true). However why I try to map the node, I get an error saying that "Both context nodes have to be bound to a model class". Upon a closer look, I realised that the model node that I created in DestinationB has no entries under the properties.
      Does anyone knows/advise how I can add the model class entry to the model node that I have created as I am not able to do so. Or otherwise, is there a way to map a model node to another model node across different components ? Thank you very much.
    from
    Kwok Wei
    from
    Kwok Wei

    Hello Pascal
      The instructioons that you gave are for mapping the model between the view controller and the component controller within the same component is that right ?
      I am tryng to map a model node in the component controller of SourceA to another model node that belongs to another Component. I do believe that in this case I will need to create a model node in the interface controller of DestinationB and map that to the component controller of SourceA. However, by creating my own model node, how do I change the property modelClass in the context ?
      Thanks !
    from
    Kwok Wei

  • SetCurrentRow does not set the right class on the new row selected

    This has to do with using setCurrentRow and having
    spry:select used on the active row to enable selection
    highlighting.
    When setting the current row programmatically by invoking
    setCurrentRow, the row get seccessfully set, but the class is not
    set to reflect that current row
    Any idea why the class of the selected row is not changing
    when I am calling setCurrentRow (works great when there is a mouse
    click)?

    Hi,
    The spry:select is a shortcut attribute that only works
    onclick.
    Check out:
    http://labs.adobe.com/technologies/spry/samples/data_region/SetCurrentRowByValueSample.htm l
    and
    http://labs.adobe.com/technologies/spry/samples/data_region/SetCurrentRowSample.html
    Thanks,
    Don

  • Setting The Enclosing Class Instance Using Reflection

    Hi,
    I'm implementing some customized deep clone mechanism.
    When I have an instance of an inner class (or anonymous inner class), I need to create a clone, that refer to a clone of the enclosing class (and not the original inner class).
    Any ideas if there's a way to implement this?
    for example
    class A implements IMyClonable
       class B implements IMyClonable
            public void cloneMe() {};
       public void cloneMe() {};
    }when cloning B instance b to bClone, the enclosing A instance of bClone, should be a clone of the enclosing A instance if b.
    Thanks,
    Roee

    s_roee wrote:
    Hi,
    I'm implementing some customized deep clone mechanism.
    When I have an instance of an inner class (or anonymous inner class), I need to create a clone, that refer to a clone of the enclosing class (and not the original inner class).
    Any ideas if there's a way to implement this?
    for example
    class A implements IMyClonable
    class B implements IMyClonable
    public void cloneMe() {};
    public void cloneMe() {};
    }when cloning B instance b to bClone, the enclosing A instance of bClone, should be a clone of the enclosing A instance if b.B.clone() retains the enclosing A instance.
    You could;
    write your A clone method
    define a copy constructor in B
    define a method in A that returns a copy of a B instance using the above B copy constructor
    have the B clone method create a clone of A and call the above copy method on this cloned instance of A.

  • Setting the "CSS Class" field not taking effect

    Hello. I defined my custom.xss as follows:
    <?xml version="1.0"?>
    <!-- $Header: custom.xss 115.2 2003/08/13 07:48:42 nigoel noship $ -->
    <styleSheetDocument xmlns="http://bali.us.oracle.com/cabo/ocelot">
    <import href="oa.xss"/>
    <styleSheet>
    <!-- Please start your customizations here -->
    <style selector=".Red">
    <includeStyle name="DefaultFontFamily"/>
    <property name="background-color">red</property>
    </style>
    <!-- Please end your customizations here -->
    </styleSheet>
    </styleSheetDocument>
    I can see my new tag defined in the generated CSS file. However, when I take my messageStyleText element and put 'Red' in the CSS Class field it does not change the background color. Am I doing something wrong?
    Thanks! Graeme.

    On Fri, 23 Mar 2007 09:53:58 +0000 (UTC), "dulcettones"
    <[email protected]> wrote:
    >Hello, I'm redoing my site from the beginning, this time
    using 'relative'
    >positioning due to browser inadequacies. Because I'm new
    to CSS I'm trying to
    >get my head around it as I go along.
    Not sure that's right - I'm sure Murray will help there
    > The first thing I'm doing is laying out my navigation
    bar at the top of the
    >page.
    > These are the CSS styles:
    > #navlist
    > #navlist ul
    > #navlist li
    > #navlist a
    > According to my book the changes to font should be done
    in #navlist ul.
    >However nothing happens when I enter the settings.
    > BUT...the changes do take effect if I use the other ones
    (#navlist / #navlist
    >li / #navlist a)
    > Can anyone help?
    >
    needs applying to the li
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
    Transitional//EN"
    http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="
    http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html;
    charset=iso-8859-1" />
    <title>Untitled Document</title>
    <style>
    .navigation ul {
    list-style: none;
    margin: 0;
    padding: 0;
    .navigation li {
    display: inline;
    font-family:"Times New Roman", Times, serif;
    font-size: 1.1em; font-style:normal; font-weight:600;
    width: 125px;}
    .navigation li a:link, .navigation li a:visited {
    padding: 2px 5px 2px 0.5em;
    background-color: #009933; /* Main backround colour */
    color: #FFFFFF; /* normal font colour */
    text-decoration: none;
    width: 125px;
    .navigation li a:hover {
    background-color: #EBF4EA; /* Main hover colour */
    color: #006600; /* hover text colour dark green */
    </style>
    </head>
    <body>
    <div class="navigation">
    <ul >
    <li><a href="x">Home</a></li>
    <li> <a href="x">One</a></li>
    <li><a href="x">Two</a></li>
    <li> <a href="x">Three</a></li>
    <li> <a href="x">Four </a></li>
    </ul>
    </div>
    </body>
    </html>
    ~Malcolm N....
    ~

  • Assigning the base class

    I have a bunch of DefaultMutableTreeNodes already created and I
    want to convert them all to myTreeNode objects which extends
    DefaultMutableTreeNode. Is there an easy way for assigning the super class of myClass which is DefaultMutableTreeNode.
    I know this doesn't work but what I want to do is something like
    setting the super class= passed in DMTN.
    I know I could create the original node1,node2 as myTreeNodes instead but these nodes are created in a bunch of different places and I would prefer not having to modify that code.
    node1 = new DefaultMutableTreeNode();
    node2 = new DefaultMutableTreeNode();
    new myTreeNode(node1);
    class myTreeNode extends DefaultMutableTreeNode{
    boolean isSelected;
    public myTreeNode(DefaultMutable TreeNode node){
    super = node.clone(); }
    }

    So you're saying you have this code:
    node1 = new DefaultMutableTreeNode();but you want to arrange things so that when it runs, it actually creates an object of some subclass of DMTN?
    No can do. While you're changing all the instances of that code, think about refactoring your application so that you don't have so many instances of it.

  • Setting Outlook Message Class

    hi All,
    I am trying to send an email using JavaMail and set the Message Class to a custom value other than IPM.Note. Could you please help me how to achieve this. I tried searching on the fourms but did not find anything.
    Thanks,
    Veen

    Hello,
    Thank you for your question.
    I am trying to involve someone familiar with this topic to further look at this issue.
    Thanks,
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]

  • How to set the size of a class that extends JDialog

    Hi,
    I was trying to set the size of my dialog window to be 600 by 600, but couldn't change it. Here is my code:
    public class alii extends JDialog {
    /** Creates new form alii */
    public alii(java.awt.Frame parent, boolean modal) {
    super(parent, modal);
    initComponents();
    private void initComponents() {
    Container contentPane = getContentPane();
    addWindowListener(new java.awt.event.WindowAdapter() {
    public void windowClosing(java.awt.event.WindowEvent evt) {
    closeDialog(evt);
    pack();
    public static void main(String args[]) {
    JFrame frame = new JFrame();
    alii a = new alii(new javax.swing.JFrame(), true);
    frame.setSize(600,500);
    frame.setLocation(200,200);
    frame.setVisible(true);}}
    Please help me with this and explain to me what is the problem and what needs to be changed.
    Cheers

    Hi,
    The code you sent me doesn't work, and the code I posted wasn't a complete, but there is the complete one. You can see now what the code does.
    * alii.java
    * Created on 15 November 2003, 13:31
    * @author Ali
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    import java.sql.*;
    import java.util.*;
    import java.io.*;
    import java.applet.*;
    import java.net.*;
    public class sun extends JDialog {
    int x[] = new int[4];
    int y[] = new int[4];
    int w[] = new int[4];
    int h[] = new int[4];
    int Y_ax = 310;
    double DrawGraf[][] = new double[4][4];
    String line[] = new String[9];
    double Perc[] = new double[4];
    double Sum=0;
    GUICanvas can;
    double graphvalue[] = new double [5];
    /** Creates new form alii */
    public sun(Frame parent, boolean modal) {
    super(parent, modal);
    initComponents();
    //setVisible(true);
    //setSize(600,500);
    //setLocation(200,200);
    /** This method is called from within the constructor to
    * initialize the form.
    * WARNING: Do NOT modify this code. The content of this method is
    * always regenerated by the Form Editor.
    private void initComponents() {
    //Container contentPane = getContentPane();
    addWindowListener(new java.awt.event.WindowAdapter() {
    public void windowClosing(java.awt.event.WindowEvent evt) {
    closeDialog(evt);
    //contentPane.setSize(700,700);
    //pack();
    public void drawthegraph(String s)
    /* try {
    URL url = new URL(
    "http://localhost:111/test/servlet/Compare?value="+s);
    BufferedReader in = new BufferedReader(
    new InputStreamReader(url.openStream()));
    for (int c = 0; c<9; c++)
    line[c] = in.readLine();
    in.close();
    }catch (Exception e){
    e.printStackTrace();
    graphvalue[0] = 200;
    graphvalue[1] = 200;
    graphvalue[2] = 100;
    graphvalue[3] = 300;
    graphvalue[4] = 20;
    //graphvalue[4] = can.d2i(graphvalue[4]);
    //System.out.println(line[8]);
    Sum = graphvalue[0]+graphvalue[1]+graphvalue[2]+graphvalue[3];
    Perc[0] = graphvalue[0]/Sum*200;
    Perc[1] = graphvalue[1]/Sum*200;
    Perc[2] = graphvalue[2]/Sum*200;
    Perc[3] = graphvalue[3]/Sum*200;
    System.out.println(Perc[0]);
    DrawGraf[0][0] = 130;
    DrawGraf[0][1] = Y_ax - Perc[0];
    DrawGraf[0][2] = 60;
    DrawGraf[0][3] = Perc[0];
    DrawGraf[1][0] = DrawGraf[0][0]+60;
    DrawGraf[1][1] = Y_ax - Perc[1];
    DrawGraf[1][2] = 60;
    DrawGraf[1][3] = Perc[1];
    DrawGraf[2][0] = DrawGraf[1][0]+60;
    DrawGraf[2][1] = Y_ax - Perc[2];
    DrawGraf[2][2] = 60;
    DrawGraf[2][3] = Perc[2];
    DrawGraf[3][0] = DrawGraf[2][0]+60;
    DrawGraf[3][1] = 310 - Perc[3];
    DrawGraf[3][2] = 60;
    DrawGraf[3][3] = Perc[3];
    for(int d=0;d<4;d++)
    x[d]=d2i(DrawGraf[d][0]);
    y[d]=d2i(DrawGraf[d][1]);
    w[d]=d2i(DrawGraf[d][2]);
    h[d]=d2i(DrawGraf[d][3]);
    repaint();
    static int d2i(double d) {return (int) Math.round(d);}
    public void paint (Graphics g)
    g.setColor(Color.red);
    for(int d=0;d<4;d++)
    g.fill3DRect(x[d],y[d],w[d],h[d],true);
    g.setColor(Color.blue);
    g.drawLine(130,130,130,310);
    g.drawLine(130,310,370,310);
    g.setColor(Color.black);
    g.drawString("WELCOME TO Ali",150,100);
    g.drawString("Region: Lambeth",430,150);
    g.drawString("Manger: ",430,170);
    g.drawString("Location: ",430,190);
    g.drawString("Number of Staff: "+graphvalue[4],430,210);
    g.drawString("Week1",135,345);
    g.drawString("Week2",195,345);
    g.drawString("Week3",255,345);
    g.drawString("Week4",315,345);
    g.drawString(" "+"20 -",100,295);
    g.drawString(" "+"40 -",100,255);
    g.drawString(" "+"60 -",100,215);
    g.drawString(" "+"80 -",100,175);
    g.drawString("100 -",100,135);
    g.setColor(Color.yellow);
    g.drawLine(130,290,370,290);
    g.drawLine(130,250,370,250);
    g.drawLine(130,210,370,210);
    g.drawLine(130,170,370,170);
    g.drawLine(130,130,370,130);
    /** Closes the dialog */
    private void closeDialog(java.awt.event.WindowEvent evt) {
    setVisible(false);
    dispose();
    * @param args the command line arguments
    public static void main(String args[]) {
    JFrame frame = new JFrame();
    sun sn = new sun(frame, true);
    frame.setSize(600,500);
    frame.getContentPane().add(sn);
    frame.setLocation(200,200);
    frame.setVisible(true);
    You were right that I am know to this, but getting there slowly and thanks for your help.
    Cheers

  • How to set the class path?-

    my forlder is :C:\Documents and Settings\india
    jdk is in:C:\Program Files\Java\jdk1.5.0_11\bin
    can any body can help me to create a classpath for my folder?

    An alternative - as stated in reply 2 in your other thread on this topic: http://forum.java.sun.com/thread.jspa?threadID=5170470 - is not to set the CLASSPATH environment variable at all. Use the -classpath switch instead.
    As the documentation linked to in that reply points out: "The class search path (more commonly known by the shorter name, "class path") can be set using either the -classpath option when calling a JDK tool (the preferred method) or by setting the CLASSPATH environment variable. The -classpath option is preferred because you can set it individually for each application without affecting other applications and without other applications modifying its value."
    As always, the documentation is worth reading; the available command line options worth using.

  • Sun ONE Studio 4 aka Forte: How to set the output path for classes ?

    Help !
    Beginner's question:
    Sun ONE Studio 4 aka Forte:
    How to set the output path for classes ?
    As default, the class files are created in the same directory as the
    sources.
    In opposite, both JBuilder and Together support that there is a tree
    with the sources and another tree with the classes.
    The first answer I got was "not possible with Forte, but just if you write your own "ANT Build script" !
    a) Please point me to a ready-to-use ANT script for this purpose, if such is available
    b) Is using ANT instead of the MAKE as comfortable ? Besides the separation of sourcecode and classes, I would like to keep everything else to be the same, i.e. I don�t want to edit the ANT file if I enlarge the project by directories or files.
    Tia
    Sincerely
    Rolf

    You can set S1S's options to place newly created .class files in a specific location.
    Identify the compiler that is being used - Open the S1S's Tools/Options window, expand Editing and select Java Sources. Note the Default Compiler value. (If it's one if the Ant options, you use Ant to specify this option, not S1S.)
    Open the S1S's Tools/Options window, expand Building/Compiler Types and select the appropriate compiler.
    The Properties tab of the compiler has the property Target, which sets the filesystem where the compiler output is directed. If you choose <not set>, the .class files are written to their source directory.
    When you set the Target, your change affects all classes that use this compiler.
    Very few options can't be set in S1S; the challenge is finding out where they're set!

  • How to set the classpath and path from the jsp to call  java class function

    Hi Exprets,
    I have a requirement to call a java class function which returns a hashmap object from the jsp. The java class in present in one jar file and that jar file is location somewhere in unix path. So the requirement is to set the classpath for that jar file and then create the object of the java class and then call the function.
    If any one know how to achieve it, please reply as soon as possible.
    thanks in advance,
    swapna soni.

    It is never advisable to store large data sets in the session. But it will depend on a lot of factors:
    1. How costly is the query retrieving the data from the database?
    If it's a complex query with lots of joins and stuff, then it will be better to store it in the session as processing the query each time will take a lot of time and will decrease performance. On the other hand if the query is simple then it's advisable not to store it in the session, and fetch it each time.
    2. Are there chances for the data to become stale within a session?
    In this case storing the data is session will mean holding the stale data till the user session lasts which is not right.
    3. How many data sets does the session already holds?
    If there are large no. of data sets already present in the session, then it's strictly not advisable to store the data in the session.
    4. Does the server employ some kind of caching mechanism?
    Using session cache can definitely improve performance.
    You will have to figure out, what is the best way analyzing all the factors and which would be best in the situation. As per my knowledge, session is the only place where session specific data can be stored.
    Also, another thing, if the data set retrieved is some kind of data to be displayed in reports, then it would be better to use a pagination query, which will retrieve only the specific no. of rows at a time. A navigation provided in the UI will retrieve the next/previous data set to display.
    Thanks,
    Shakti

  • Where to set the classpath for custom classes in jsp

    Hi,
    we have created our custom classes in and ported in contentDB and that classes are internally using some jar files. Previously we have set the classpath of all the jar files provided in CDB devkit in the orion-web.xml but if are opening the explorer.jsp or any other jspx of contentDB we are getting the classcastexception and page is not opening.
    Is there any problem in setting the classpath. Please if any one knows abt this, reply as soon as possible.
    thanks,
    swapna soni.

    I think it is Oracle 10g Release 2... since when I click the top OAS link in the Enterprise Manager Console, it took me to 'Enterprise Manager 10g Grid Control Release 2' this page.
    And...10g Application Server Control Release 10.1.2.0.1, I think 2.0.1 means Release 2.
    Thanks and let me know if you need something else.

  • How do i set the contentStyle of textbox in my controller class on pageload

    Hi All,
    I have a requirement where i need to set the contentStyle of a textbox as well as the border of textbox as per condition on page load.
    I am trying this code but unable to set it properly.
    *public void onLoad() {*
    FacesContext context = FacesContext.getCurrentInstance();
    ExtendedRenderKitService erks =
    Service.getRenderKitService(context, ExtendedRenderKitService.class);
    erks.addScript(context,"AdfPage.PAGE.findComponent('it15').setProperty('ContentStyle',background-color:#00C0C0);");
    Am i missing something ??
    Is there any other method to achieve my requirement ?
    Please suggest!!
    Thanks!!

    Hi Accadsoft,
    I have tried with this but nothing happens :-
    I have used this code in my controller class :-
    FacesContext context = FacesContext.getCurrentInstance();
    ExtendedRenderKitService erks =
    Service.getRenderKitService(context, ExtendedRenderKitService.class);
    erks.addScript(context,"AdfPage.PAGE.findComponentByAbsoluteId('it3').setProperty('ContentStyle',background-color:#00C0C0);");
    Please find the below Jspx code snippet as well...:-
    <af:form id="f1"
    binding="#{backingBeanScope.backing_TimeCostedInvoices.f1}">
    <af:panelFormLayout binding="#{backingBeanScope.backing_TimeCostedInvoices.pfl1}"
    id="pfl1" maxColumns="3" rows="1">
    <af:inputText value="#{bindings.Totalamount.inputValue}"
    label="#{bindings.Totalamount.hints.label}"
    required="#{bindings.Totalamount.hints.mandatory}"
    columns="#{bindings.Totalamount.hints.displayWidth}"
    maximumLength="#{bindings.Totalamount.hints.precision}"
    shortDesc="#{bindings.Totalamount.hints.tooltip}"
    binding="#{backingBeanScope.backing_TimeCostedInvoices.it3}"
    id="it3">
    <f:validator binding="#{bindings.Totalamount.validator}"/>
    <af:convertNumber groupingUsed="false"
    pattern="#{bindings.Totalamount.format}"/>
    </af:inputText>
    <af:selectOneChoice value="#{bindings.Doctypedesc.inputValue}"
    label="#{bindings.Doctypedesc.label}"
    required="#{bindings.Doctypedesc.hints.mandatory}"
    shortDesc="#{bindings.Doctypedesc.hints.tooltip}"
    binding="#{backingBeanScope.backing_TimeCostedInvoices.soc1}"
    id="soc1"
    valueChangeListener="#{backingBeanScope.backing_TimeCostedInvoices.getValue}"
    autoSubmit="true">
    <f:selectItems value="#{bindings.Doctypedesc.items}"
    binding="#{backingBeanScope.backing_TimeCostedInvoices.si1}"
    id="si1"/>
    </af:selectOneChoice>
    </af:panelFormLayout>
    </af:form>
    I am just thinking whether the syntax is appropriate on this line :-
    erks.addScript(context,"AdfPage.PAGE.findComponentByAbsoluteId('it3').setProperty('ContentStyle',background-color:#00C0C0);");
    Please suggest!!!

  • Set the class of a paragraph style to export in HTML

    How, in AppleScript, set the class of a paragraph style to export in HTML?
    I try with "style export tag map", but doesn't works!
    Thank's

    I found a way
    tell application "Adobe InDesign CS6"
      tell document 1
      tell paragraph style 2
      --get count of style export tag map
      tell style export tag map 1 -- HTML  , 2 = PDF
      --get export class
      --get export tag
      set export tag to "H1"
      set export class to "blue"
      end tell
      end tell
      end tell
    end tell
    and its works
    but thanks for help to use the class "style export tag map"

Maybe you are looking for

  • J2EE adapter monitoring problem/no error description found

    Hi!!! I have a problem with J2EE adapter monitoring. When I use SOAP adapter (receiver, asynchronous mode) and there is an error in Web Service (for example, the structure of the message is incorrect) then in Workbench (in an adapter monitoring) I ca

  • Number copy from DMS to Authocad

    Hi, Is it possible in sap dms, that once the dms document number is generated, it can be automatically transferred or paste on to the autocad drawing. Regards, Punam

  • [CS3 | JS] Can't modify geometricBounds of object

    Okay, I've built some very complex scripts in VB but I'm now working on my Thesis on a Mac and trying to script in JS and some things I probably shouldn't be having problems with, I am. Like this one: I can't modify (or even read) the geometricBounds

  • Mouse wheel value update

    Hello everyone I am trying to get the value from "mouse scroll" changed by mouse wheel. The attached code is very simple and seems to be right wired, but it's not working properly. If you run the VI and scroll up and down  mouse wheel, you will see t

  • Firefox - ArchWiki Problem: (-bash: convert:: command not found)

    <Post Deleted> Last edited by gfx010 (2010-07-24 08:24:31)