TCP/IP Sockets Comunication by user defined DLL Class

i will describe it briefly. i need to create a dll class to establish a socket communication and that dll class i should use it between the client App and the server App. but the main task is not done yet which is how to enforce editing to the display
controls in both Apps by the Class functions. that is it. any help will be appreciated.

"what i missing here is how to enforce any control on the server App to display the received messages once the client thread send it"
You cannot enforce this simply by creating a class and/or putting it into a library.  Your MySocket class could generate an event when a message is received but you cannot force client code to do anything about it.  It
is responsibility of the server code to handle the message and react accordingly.
"I know i have to specify by coding a specific function on the server side to override another function in the created socket class and that what i'm trying to do."
Client and server have nothing to do with each other in this case.  Your server side code isn't going to be able to do anything on the client side.  That is the whole reason you're using a client-server architecture.  You can create a client
class that receives pre-defined messages from the server and handles them.  You can also make these methods virtual so that clients can derive from your client class and do something different for the messages it cares about. 
//Code on server side
public class MyServer
public void SendMessage ( string message )
//Send message via socket
//Code in client side type that can be re-used by any client
public class MyClient
protected virtual void OnMessageReceived ( string message )
//Do something with the message
private void HandleMessagesFromServer ()
//Infrastructure to monitor socket for messages,
//determine "message" received and call appropriate
//method for processing
//Ex: If server sent a message containing a single string
OnMessageReceived(stringFromServer);
//A client may override the behavior for the message(s)
public class MyCustomClient : MyClient
protected override void OnMessageReceived ( string message )
base.OnMessageReceived(message);
//Notify my UI of the message
Alternatively you could define a series of events that are raised when messages are received. 
//Server code doesn't really change
//Client code uses events instead of virtual methods
public class MyClient
public event EventHandler<MessageReceivedEventArgs> MessageReceived;
private void ProcessMessagesFromServer ()
//Responsible for watching the socket for messages,
//translating the messages from the socket and
//raising the event(s)
//i.e. Raising an event
if (MessageReceived != null)
MessageReceived(this, new MessageReceivedEventArgs(stringFromServer));
//Clients can handle events instead
public class SomeUIElement
//Some initialize method
private void Initialize ( MyClient client )
client.MessageReceived += OnMessageReceived;
private void OnMessageReceived ( object sender, MessageReceivedEventArgs e )
//Do something with message like display it
//Note: This is probably not running on UI thread
Either approach allows a client to react to notifications from the server.  However on the server side all you really need to do is send the appropriate message via the socket.  The client is responsible for reacting to that message in whatever
way is most appropriate. 
Michael Taylor
http://blogs.msmvps.com/p3net

Similar Messages

  • How to use user defined exception class

    Hi all
    I just need som help with creating a user defined exception class.
    Im writing a small/simple text editor.
    My exception class looks like this:
    public class myExcp extends Throwable
         private String message;
         public myExcep(String message)
              this.message = message;
         public void display()
              System.out.println(message);
    I would like to use it when a user tries to open a exe-file instead of a txt file.
    Here is some code from the editor:
    if (e.getSource() == open)
    saveOld();
    if (fc.showOpenDialog(null)== JFileChooser.APPROVE_OPTION)
    readFile(fc.getSelectedFile().getAbsolutePath());           
    saveas.setEnabled(true);                
    So, should I use exception here or at the readFile method?
    readfile:
    private void readFile(String fileName)
    try
    String tmp = fileName.substring(fileName.length() -4, fileName.length());
    if (!tmp.equals(".exe"))
    FileReader r = new FileReader(fileName);
    textarea.read(r, null);
    r.close();
    currentFile = fileName;
    label.setText(currentFile);
    changed = false;
    catch (IOException e)
    JOptionPane.showMessageDialog (this, "Cannot find the file " + fileName);
    Where and how do I use my exception class.
    Do I need to create an instance? Where?
    Should the exception class extend Exception instead?
    Thank you in advance /

    Extend Exception, not Throwable. It's a checked exception that way.
    Follow the Sun coding standards and make that exception class name start with a capital letter.
    When you extend Exception, override all four ctors.
    What's that display method you added? Isn't getMessage() good enough?
    You need to create a new instance just before you throw the exception, of course.
    Sounds like a terrible design, by the way. Exceptions shouldn't be used like "go to" for app logic. They should signal unrecoverable conditions. You can easily recover from the situation you've described simply by displaying a pop-up that tells the user to open only text-readable file types. I think that's a better solution.
    %

  • Recon and provisioning of user-defined object class ICF Active Directory

    I have followed the documentation instructions for reconciliation of a user-defined object class in the ICF Active Directory connector. I am using OIM 11gR2 with the ICF Active Directory 11.1.1.5 connector patched to 11.1.1.5.0A. The procedure states to create the new object class in AD and then change the objectClass value in the Lookup.Configuration.ActiveDirectory lookup. In my case I am using the existing ObjectClass of contact, rather than a new object class. Just for completeness I am using a clone of the AD User Resource Object which I call AD User Contact and so my lookup name is Lookup.Configuration.ActiveDirCon.
    When I changed the ObjectClass from User to Contact, and ran the Active DirCon User Target Recon scheduled job, with Object Type also = contact. The first issue I noticed was that the connector wanted a different set of lookups, which is not in the documentation. It is looking for a lookup in my Configuration lookup where code key=contact Configuration Lookup (which I should have expected since there are code keys for User, Group, and organizationalUnit). I added a line to the lookup where code key=contact Configuration Lookup and the Decode=Lookup.ActiveDirCon.CM.Configuration and then I created a new lookup by that name, assigning the 5 values to be the Lookup.ActiveDirCon.UM.xxx lookups. I did not see any need to create a new set of Lookup.ActiveDirCon.CM.xxx lookups with the exact same values.
    I re-ran the scheduled job and it ran successfully, but did not generate any Recon Events, even though I had objects in the OU and I have that same OU in the Lookup.ActiveDirCon.OrganizationalUnits lookup (from the Org Lookup Recon). Everything looks good but getting no results. Looked at the log file from the ConnectorServer and it is building the query properly and executing it properly with the correct syntax, getting no errors, but the SearchAndReturnObjects method is returning zero results.
    Looking to see if anyone has successfully reconciled in user-defined or other non-User objectClass objects from Active Directory, and if so, can you provide Lookup configuration and Connector Server information so I can troubleshoot.
    I resolved this issue by changing the recon lookups to a blank lookup called Lookup.ActiveDirCon.CM.ReconAttrMap and only added in the parameters that are used by a Contact object. Only populate the ReconAttrMap with parameters that exist for the custom object.
    Edited by: Keith Smith AptecLLC on Mar 27, 2013 6:31 AM

    Oracle Support answered this question via SR

  • Import user defined actionscript classes in mxml

    Hi,
    I have an mxml file -- A.mxml
    I have an actionscript file asfile.as  This file has a class definition. Package name - 'MyPackage' Class name - 'asfile'
    I want to import this class into A.mxml
    So, I write "import MyPackage.asfile.*;" in the Script block of A.mxml. Please note that both A.mxml and asfile.as are part of the same FlashBuilder project and  are present at the same level (i.e. inside the same folder) in Package Explorer.
    I get a compiler error "A file found in a source-path must have the same package structure '', as the definition's package, 'MyPackage'."
    Please help me solve this issue.
    Regards,
    Pooja

    It looks like you forgot to include asfile class in MyPackage package.
    package MyPackage
         public class asfile
    Write import statement in MXML as 'import MyPackage.asfile;'

  • User defined method

    Heres the score, I have created this game but I need to create a new method (which I have never done before and need some guidance) When you play the game after each shot the programme should tell you if you are hot or cold, but this is not doing it after each shot, plus at the end of the game the programme should tell the user how good they were at the game. Anyway that bit works but i need to create a method for the "how close" part of the window. Any help would be great.
    import javax.swing.JOptionPane;
    public class CourseworkPart1{
         public static void main(String args[]) {
              int randomNum, usersGuess = 0, diffNum, numGoes = 0;
              String output= "";
              String output2 = "";
              //generate a random between 1 and 10 inclusive
              randomNum = (int) (Math.random()*10) +1;
              //Allows the user to guess three times
           for (int numAttempts = 1; numAttempts <=10; numAttempts++){
              //users guess
              usersGuess = Integer.parseInt(JOptionPane.showInputDialog("please enter a number"+ randomNum));
              //difference between random number and users guess
            diffNum = (usersGuess - randomNum);
            //users guess compared to the generated random number
              if (randomNum == usersGuess){
                   output = "You won";
                   numGoes = numGoes ++;
            //call method
                   //else {
                   //     output = "The Random number was " + randomNum ;
                   //How close is the players guess
                switch (diffNum){
                    case 1:
                        output = "hot";
                        break;
                    case -1:
                       output = "hot";
                        break;
                 case 2:
                       output = "warm";
                    break;
                 case -2:
                       output = "warm";
                    break;
                 default:
                        output = "cold";
                        break;
               //Players ratings
               switch(numGoes){
                      case 1:
                           output = "champion";
                           break;
                      case 2:
                       output = "professional";
                       break;
                      case 3:
                       output = "advanced";
                       break;
                      default:
                       output = "amateur";
                       break;
              //print message
              JOptionPane.showMessageDialog(null, output, "Player's Guess",
                                                      JOptionPane.INFORMATION_MESSAGE);
    System.exit(0);
    //User defined method

    public class AATest1
         public static void displayEvaluation(String rating)
              System.out.println("You were: " + rating);
         public static void main(String[] args)
              String str = "hot";
              displayEvaluation(str);
    }

  • How to apply dll file or user defined function in B1

    Dear all,
    I have dll file and user defined function which use for converting number amount to text of my language. I plan to create UDF to keep the result of function on A/R invoice and I will use this UDF on print layout desiner but I don't know how to apply my function on B1. Please kindly suggest.
    Thanks you in advanced.
    Angnam

    Hi Angnam,
    Check this link.
    Re: amount in words
    Thanks,
    Srujal Patel

  • User-defined object dll saving.

    Hi Experts,
    we have successfully created a User-defined object and we have registered it.
    When we try to save a dll we have created by code we get an error," invalid path"
    any ideas what will cause such an error.
    Urgent help to solve this will be appreciated.
    Regards,
    Justice

    Please look at the following article:
    http://livedocs.adobe.com/livecycle/8.2/programLC/programmer/help/000959.html
    Jasmin

  • User Defined Function (UDF) help required. Pls advice urgent.

    Hi ,
    CRM -- XI (UDF) -- Socket Connection
    Now in User Defined Function (UDF) of Message Mapping I will open Socket Connection.
    Send CRM XML request to socket and get XML response from Socket and then map to some system.
    Can I write Java Class code in User Defined Function (UDF)  of Message Mapping instead of Java Mapping in blog below?
    /people/saravanakumar.kuppusamy2/blog/2005/12/15/socket-integration-with-xi
    Regards

    Henry,
    Do you have a structure for your response...if you do then you can do extended reciever det with sync/async..shouldent matter, i just tried it and i dont get any error.
    in your reciever determination..Check the box for standard rec det then add your first condition..of the value of a field to true..then send to A..
    then you select add condition..and add for second reciever..that should be it, you shouldent need a bpm for such a simple scenario..it definetly is an overkill.
    Regards
    Ravi Raman

  • Can we show some user defined message while cube loading in OBIEE

    Hi All,
    Currently we are building OBIEE dashboards from Essbase ASO Cube as datasource.
    During Essbase Cube loading ,Essbase will "Disable all Administrative Commands".In this mean time,When users are trying to run the dashboards,OBIEE will thorws severe error.
    Can we dispaly some user defined message something like "Cube is loading.Please wait...." or any other alternative.
    Time taken to load the cube is 1hr.Please suggest
    Thanks,
    SatyaB

    Yes, You can better try replacing the whole OBIEE dashboard with a custom message. Whenver the load happens...you shud trigger or set a flag value to 'Y'. Using guided navigation when Flag value is matched to Y...right a JS to replace the whole dashboard.
    [html]
    [head]
    [script type="text/javascript"]var strStatus="@1";
    if(strStatus =='Y')
    location.replace('saw.dll?PortalPages&_scid=in6lPJnWWNk&PortalPath=/shared/Framework/_portal/Cube%20Status%20&Page=Cube%20Status');
    [script]
    [head]
    Replace square bracket with curly brackets in above replace code..
    BTW, you shud mark the previous post on Implicit fact. Follow https://forums.oracle.com/forums/ann.jspa?annID=939

  • User Defined Default Starting Page

    Hopefully an easy question...what table holds the user defined default starting page? Specifically in 11g.
    Thanks!

    Hi,
    Tried to set default dashboard for all the users.
    1. Created a session init block
    2. Used data source as select '/shared/SH Test/_portal/Test1' from dual
    3. Assigned this value to PORTALPATH session variable
    4. In Presentation services > Administration > My account > Default dashboard should be set to 'default'. Then only the dashboard specified in init block will be displayed otherwise My account will override the init block.
    5. Save the changes made to rpd.
    5. Logout and relogin to see if it is working fine. it is working perfectly fine.
    For details please refer the GSC replication document. But it is for all the users.
    if customer would like to have user/group based home page.
    1. They may need to have 2 separate tables.
    i. Group_path_tab with 2 columns. Group_id, portal_path
    Have group wise portal path for all the groups
    ii. User-group map table
    Group_id, Group_name, user_id
    User should be part of some group.
    2. Then in the init block write the sql should be something like this
    select A.portal_path from Group_path_tab A, User_group_map B
    where B.user_id = :USER
    and B.Group_id = A.Group_id
    SO based on USER session variable, it will try to identify the group and then the portal_path.
    Finally assign this value to PORTALPATH session variable.
    xample:
    Kindly refer the below one..it will very helpful to set homepage for to be different on a per user/group basis
    http://varanasisaichand.blogspot.com/2010/09/default-dashboard-using-portalpath.html
    http://total-bi.com/2011/01/obiee-11g-change-default-dashboard/
    i.e:
    Init block
    select '/shared/AFS/_portal/GPC AFS Reporting' from dual
    Variable target is PORTALPATH (IT'S CASE SENSITIVE)
    '/shared/AFS/_portal/GPC AFS Reporting'
    finally it's be like this
    actual (earliar one)
    http://w01sgpcbiapp1a:9704/analytics/saw.dll?dashboard&PORTALPATH=&/shared/AFS/_portal/GPC AFS Reporting
    after calling default one :
    http://w01sgpcbiapp1a:9704/analytics/saw.dll?dashboard&PortalPath=%2Fshared%2FAFS%2F_portal%2FGPC%20AFS%20Reporting
    My earliear post :
    https://forums.oracle.com/forums/thread.jspa?messageID=9917328&#9917328
    Thanks
    Deva
    Edited by: Devarasu on Oct 18, 2011 9:24 AM

  • Where does Designer stores user defined custom colors?

    Hi,
    Everytime I restart Designer, all my custom colors are reset to white. Which is pretty annoying. So I want to export them to a file at least.
    I figured, that user defined custom colors in Windows are stored in the Registry in:
    [HKEY_CURRENT_USER\Control Panel\Custom Colors]
    or alternatively in:
    [HKEY_USERS\.DEFAULT\Control Panel\Colors]
    But apparently they are not. Changes made to the custom color palette in Designer are not stored in the registry. Those values still remain FFFFFF.
    Does anyone know, where Designer stores user defined custom colors? Is there a 'secret' undocumented .ini-file I missed?
    Regards,
    Steve

    Does anyone know where the information added by Java reside?Essentially, in the directory.
    Is there any way to query this information using VC++ dll or some other way?Yes, there are operating system APIs for it. That's how Java does it.
    Does anyone know which windows dll or classes are used by Java to add these custom attributes
    I tried lot by digging into code by decompiling java NIO classes but could not get it.I would try looking up the Windows API myself.

  • How register user defined listener name with OEM

    DEFAULT LISTENER
    [oracle@localhost ~]$ lsnrctl status
    LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 06-SEP-2010 10:03:46
    Copyright (c) 1991, 2007, Oracle. All rights reserved.
    Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
    TNS-12541: TNS:no listener
    TNS-12560: TNS:protocol adapter error
    TNS-00511: No listener
    Linux Error: 111: Connection refused
    USER DEFINED LISTENER
    [oracle@localhost ~]$ lsnrctl status LISTENER_LIMCAMP
    LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 06-SEP-2010 10:04:03
    Copyright (c) 1991, 2007, Oracle. All rights reserved.
    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.106.72)(PORT=1521)))
    STATUS of the LISTENER
    Alias LISTENER_LIMCAMP
    Version TNSLSNR for Linux: Version 10.2.0.4.0 - Production
    Start Date 03-SEP-2010 19:42:11
    Uptime 2 days 14 hr. 21 min. 52 sec
    Trace Level off
    Security ON: Local OS Authentication
    SNMP OFF
    Listener Parameter File /ora10gsoft/oracle/product/10.2.0/db_1/network/admin/listener.ora
    Listener Log File /ora10gsoft/oracle/product/10.2.0/db_1/network/log/listener_limcamp.log
    Listening Endpoints Summary...
    (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.106.72)(PORT=1521)))
    Services Summary...
    Service "LIMCAMP" has 1 instance(s).
    Instance "LIMCAMP", status UNKNOWN, has 1 handler(s) for this service...
    The command completed successfully
    I am able to connected thru listener.
    But my OEM database control showing
    Host localhost.localdomain
    Port 1521
    SID LIMCAMP
    Oracle Home /ora10gsoft/oracle/product/10.2.0/db_1
    Status Down
    Host localhost.localdomain
    Port 1521
    Name LISTENER
    Oracle Home /ora10gsoft/oracle/product/10.2.0/db_1
    Location /ora10gsoft/oracle/product/10.2.0/db_1/network/admin
    Details TNS-12541: TNS:no listener
    My OEM taking the default LISTENER( which is not running). how to register OEM to take the listener (LISTENER_LIMCAMP).

    # Do not remove the following line, or various programs
    # that require network functionality will fail.
    127.0.0.1 localhost.localdomain
    192.168.106.72 localhost.localdomain
    would you please have a look into the below link which is the issue on the same server.
    Heartbeat failed to connect to standby : archive files not transfering....
    Edited by: SAKTHIVEL on Sep 6, 2010 11:45 AM

  • Updating User-defined

    Hello,
    Please can someone confirm if it is possible to populate a user-defined table that has been created as a "Master Data" object type via the DI. The table has been regsitered as a use-defined object. I basically want to write to this table.
    Regards
    John

    Hi John,
    That's not possible. You can do if it's not defined as UDO. Actually most of us are waiting for SAP to expose that functionality. What you can do is import values from a file when you register the object (not DI API) There's a SAP note about it.
    Another option is use a meta-UDO to fill the UDO, like I saw Frank Moebius do in a live expert session (crazy idea, no doubt :P), which is not DI API just UI API and dll programming.
    HTH,
    Ian

  • Why user defined objects printing address

    If we try to print Builtin java objects it will give The class name and properties. If we try to print a user defined class even though it extends from a bultin class it is not happening so why?

    Hi Joyce,
    The dll option allows you to add custom data validation and functions for the UDO. It doesn't have any affect on whether the default form opens or not.
    What version of SBO are you working with? The default forms were enhanced in version 9 but, as far as I'm aware, if you selected the option in the UDO registration to use a default form then it should always open (ie if the menu option appears then the screen should be available). One thing to note is that you sometimes have to log out and log back in to SBO before the client recognises the new UDO (you should only need to do this the first time you add the UDO and not when making changes to an existing one).
    Kind Regards,
    Owen

  • Itunes has encountered a user-defined breakpoint?

    itunes has encountered a user-defined breakpoint? i tried debugging but it still crashed...
    i uninstalled everything and deleted all my caches and genius files. and then reinstalled but it happens everytime i run itunes match.
    any help?
    Problem signature:
      Problem Event Name:          APPCRASH
      Application Name:          iTunes.exe
      Application Version:          10.6.1.7
      Application Timestamp:          4f71aced
      Fault Module Name:          KERNELBASE.dll
      Fault Module Version:          6.1.7601.17651
      Fault Module Timestamp:          4e211319
      Exception Code:          80000003
      Exception Offset:          0001280c
      OS Version:          6.1.7601.2.1.0.256.1
      Locale ID:          1033
      Additional Information 1:          0a9e
      Additional Information 2:          0a9e372d3b4ad19135b953a78882e789
      Additional Information 3:          0a9e
      Additional Information 4:          0a9e372d3b4ad19135b953a78882e789
    Read our privacy statement online:
      http://go.microsoft.com/fwlink/?linkid=104288&clcid=0x0409
    If the online privacy statement is not available, please read our privacy statement offline:
      C:\Windows\system32\en-US\erofflps.txt

    tried updating itunes match in safe mode....same thing
    Problem signature:
      Problem Event Name:          APPCRASH
      Application Name:          iTunes.exe
      Application Version:          10.6.1.7
      Application Timestamp:          4f71aced
      Fault Module Name:          KERNELBASE.dll
      Fault Module Version:          6.1.7601.17651
      Fault Module Timestamp:          4e211319
      Exception Code:          80000003
      Exception Offset:          0001280c
      OS Version:          6.1.7601.2.1.0.256.1
      Locale ID:          1033
      Additional Information 1:          0a9e
      Additional Information 2:          0a9e372d3b4ad19135b953a78882e789
      Additional Information 3:          0a9e
      Additional Information 4:          0a9e372d3b4ad19135b953a78882e789
    Read our privacy statement online:
      http://go.microsoft.com/fwlink/?linkid=104288&clcid=0x0409
    If the online privacy statement is not available, please read our privacy statement offline:
      C:\Windows\system32\en-US\erofflps.txt

Maybe you are looking for

  • Crystal report parameter usage

    Hi all, I am facing a issue in designing crystal report. I want to display records in report as per user entered value of date parameter but  in database if data is not present for given input date value then the report should run for value which is

  • Issue with AdvancedDataGrid in Flex SDK 3.3

    Hello Forum, I downloaded and installed Flex SDK 3.3. Once I pointed my environment to the SDK 3.3, compiler complained that it can't find AdvancedDataGrid component in the path. After some investigation, I was able to fix this issue by downloading F

  • Active and inactive vendor

    Hi Guys can any one explain what is active and inactive vendor and how to see the list of vendor master. G.Krishnamohan

  • Bluetooth device panel not saving devices

    Hello everyone, I have an original Macbook Pro (Dual Core 1) and I have a little bluetooth issue. First of all, I have a logitech bluetooth keyboard and mouse. Both have been working correctly in windows for several months. Just recently both stopped

  • Workflow for network activity confirmation CN25

    Dear Experts, In CN25 tcode for network i am giving the input and pressing save button. In that tcode there are three activity status namely partial confirmation, manual confirmation and confirmation i.e PCNF, MCNF and CNF. I am using BO AFVC_NETW to