Creating Peer to Peer connections using intermediate server

I want to connect two clients (via TCP/IP sockets in Java). The clients can discover each other using an intermediate server. Once the clients discover each other, there should not be any involvement of the server.
I made some study about this and found many people suggesting JXTA. But I'd like to create the protocol myself from scratch (because in future I might have to implement the same using WebSockets as well (when my client is a Browser)). Currently, my clients can be Desktop applications or mobile applications.
My questions are:
1. How will clients discover each other at the server? If the server sends the global IP address of the clients to each other, will that information be enough to create a peer-to-peer connection? What if the clients are on the same LAN network and the server is on a different WAN?
2. Client have dynamic IP address. Can their IP change all of a sudden even if it has an active socket?
3. Is peer-to-peer connection is reliable for transfer of non-continuous data (like in chat application)?
[*NOTE*: by peer-to-peer connection I mean establishing a client-server TCP/IP socket connection by making one of the client as temporary socket-server]
Thanks in advance.

two clients (via TCP/IP sockets in Java). The clients can discover each other using an intermediate server.If you only have 2 clients, it's hardly worth putting a server between them; a client 'discovering' the server is as much work as one client discovering the other.

Similar Messages

  • How to create a DSN Less Connection using MySQL

    Hi All
    How to create a DSN Less Connection using MySQL?
    http://www.caucho.com/projects/jdbc-mysql/index.xtp and downloaded Caucho driver and installed the jar ---- caucho-jdbc-mysql-0.2.7.jar in my classpath..
    this is how i embedded the code
    try
    driver = (Driver) Class.forName("com.caucho-jdbc-mysql-0.2.7.Driver").newInstance();
    catch (Exception e)
    lastErr = "Cannot load the driver, reason:"+e.toString();
    nothing seems to work with code..
    Unable to proceed..Any piece of code would be of great help..
    Thanks and regds
    Gautam

    According to the installation instructions for that driver:
    The driver is com.caucho.jdbc.mysql.Driver
    The url is jdbc:mysql-caucho://hostname:port/database
    You used something else for the driver name. So it doesn't work. By the way, I found those instructions here: http://www.caucho.com/projects/jdbc-mysql/

  • Error while creating a new DAC connection using connection type MSSQL

    Hi,
    I am trying to create a new DAC connection i.e. a new DAC repository in the SQL Server 2008 database.
    DAC version : 10.1.3.4.1
    Database : SQL Server 2008
    I have downloaded the sqljdbc4.jar file from the below link and placed it in the D:\orahome\10gR3_1\bifoundation\dac\lib folder.
    [http://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=11774 ]
    I have entered all the details correctly for database name, database host, database port. I created a new Authentication file.
    I get the below error when I try to test the connection.
    MESSAGE:::MSSQL driver not available!
    EXCEPTION CLASS::: java.lang.IllegalArgumentException
    com.siebel.etl.gui.login.LoginDataHandler$LoginStructure.testConnection(LoginDataHandler.java:512)
    com.siebel.etl.gui.login.LoginDataHandler.testConnection(LoginDataHandler.java:386)
    com.siebel.etl.gui.login.ConnectionTestDialog$Executor.run(ConnectionTestDialog.java:290)
    ::: CAUSE :::
    MESSAGE:::com.microsoft.sqlserver.jdbc.SQLServerDriver
    EXCEPTION CLASS::: java.lang.ClassNotFoundException
    java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    java.security.AccessController.doPrivileged(Native Method)
    java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
    java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    java.lang.Class.forName0(Native Method)
    java.lang.Class.forName(Class.java:169)
    com.siebel.etl.gui.login.LoginDataHandler$LoginStructure.testConnection(LoginDataHandler.java:510)
    com.siebel.etl.gui.login.LoginDataHandler.testConnection(LoginDataHandler.java:386)
    com.siebel.etl.gui.login.ConnectionTestDialog$Executor.run(ConnectionTestDialog.java:290)
    The error seems to be a connectivity issue with SQL Server. Am I using the correct jar file?
    Please help me out in resolving this issue. Appreciate the help provided on this forum earlier.
    Thank You

    Add
    .\lib\sqljdbc4.jar
    at end of the line starting with SQLSERVERLIB in config.bat file
    Pls mark correct

  • Unable to Create a Content Repository Connection using 'socketssl'

    I'm trying to create a Content Repository Connection with RIDC Socket Type as "socketssl".
    I am not able to create the connection. The following are the parameters mentioned in Jdeveloper
    RIDC Socket Type : socketssl
    Server Host Name : <ip of the content server>
    Content Server Listener Port : 54444 (incoming SSL provider is configured in the content server)
    KeyStore File Location : patch of the client keystore
    KeyStore Password : password
    Private Key Alias : PrivateKey Alias Name
    Private Key password : password
    I get the below error. However I am able to use RIDC to connect to UCM using socketssl. This problem is seen only with jdeveloper.
    SEVERE: Submission[id=1, service=oracle.webcenter.content.jcr.login, resource=ucm] caught exception running task
    javax.jcr.RepositoryException: oracle.stellent.ridc.protocol.ProtocolException: java.net.SocketException: Software caused connection abort: recv failed
         at oracle.jcr.impl.ExceptionFactory.repository(ExceptionFactory.java:161)
         at oracle.stellent.jcr.IdcPersistenceManagerFactory.createPersistenceManager(IdcPersistenceManagerFactory.java:185)
         at oracle.jcr.impl.OracleRepositoryImpl.login(OracleRepositoryImpl.java:444)
         at oracle.vcr.jam.LoginTask.call(LoginTask.java:68)
         at oracle.vcr.jam.LoginTask.call(LoginTask.java:29)
         at oracle.webcenter.concurrent.Submission$2.run(Submission.java:484)
         at java.security.AccessController.doPrivileged(Native Method)
         at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
         at oracle.webcenter.concurrent.Submission.runAsPrivileged(Submission.java:498)
         at oracle.webcenter.concurrent.Submission.run(Submission.java:424)
         at oracle.webcenter.concurrent.Submission$SubmissionFutureTask.run(Submission.java:888)
         at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
         at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
         at java.util.concurrent.FutureTask.run(FutureTask.java:138)
         at oracle.webcenter.concurrent.ModifiedThreadPoolExecutor$Worker.runTask(ModifiedThreadPoolExecutor.java:657)
         at oracle.webcenter.concurrent.ModifiedThreadPoolExecutor$Worker.run(ModifiedThreadPoolExecutor.java:682)
         at java.lang.Thread.run(Thread.java:662)
    Caused by: oracle.stellent.ridc.protocol.ProtocolException: java.net.SocketException: Software caused connection abort: recv failed
         at oracle.stellent.ridc.protocol.intradoc.HdaProtocol.readResponse(HdaProtocol.java:254)
         at oracle.stellent.ridc.IdcClient.sendRequest(IdcClient.java:165)
         at oracle.stellent.jcr.IdcPersistenceManagerFactory.createPersistenceManager(IdcPersistenceManagerFactory.java:171)
         ... 15 more
    Caused by: java.net.SocketException: Software caused connection abort: recv failed
         at java.net.SocketInputStream.socketRead0(Native Method)
         at java.net.SocketInputStream.read(SocketInputStream.java:129)
         at com.sun.net.ssl.internal.ssl.InputRecord.readFully(InputRecord.java:293)
         at com.sun.net.ssl.internal.ssl.InputRecord.read(InputRecord.java:331)
         at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:798)
         at com.sun.net.ssl.internal.ssl.SSLSocketImpl.waitForClose(SSLSocketImpl.java:1523)
         at com.sun.net.ssl.internal.ssl.HandshakeOutStream.flush(HandshakeOutStream.java:103)
         at com.sun.net.ssl.internal.ssl.Handshaker.sendChangeCipherSpec(Handshaker.java:689)
         at com.sun.net.ssl.internal.ssl.ClientHandshaker.sendChangeCipherAndFinish(ClientHandshaker.java:985)
         at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverHelloDone(ClientHandshaker.java:904)
         at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:238)
         at com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Handshaker.java:593)
         at com.sun.net.ssl.internal.ssl.Handshaker.process_record(Handshaker.java:529)
         at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:893)
         at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1138)
         at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:753)
         at com.sun.net.ssl.internal.ssl.AppInputStream.read(AppInputStream.java:75)
         at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
         at java.io.BufferedInputStream.read(BufferedInputStream.java:237)
         at oracle.stellent.ridc.common.util.StreamUtil.readRawLine(StreamUtil.java:227)
         at oracle.stellent.ridc.common.util.StreamUtil.readLine(StreamUtil.java:254)
         at oracle.stellent.ridc.protocol.intradoc.HdaProtocol.readHeaders(HdaProtocol.java:453)
         at oracle.stellent.ridc.protocol.intradoc.HdaProtocol.readResponse(HdaProtocol.java:215)
         ... 17 more
    31/10/2011 2:14:29 PM oracle.webcenter.content.internal.dt.connection.wizard.AdapterConfigPanel validateConfig
    WARNING: Invalid Configuration Parameters
    javax.jcr.RepositoryException: oracle.stellent.ridc.protocol.ProtocolException: java.net.SocketException: Software caused connection abort: recv failed
         at oracle.jcr.impl.ExceptionFactory.repository(ExceptionFactory.java:161)
         at oracle.stellent.jcr.IdcPersistenceManagerFactory.createPersistenceManager(IdcPersistenceManagerFactory.java:185)
         at oracle.jcr.impl.OracleRepositoryImpl.login(OracleRepositoryImpl.java:444)
         at oracle.vcr.jam.LoginTask.call(LoginTask.java:68)
         at oracle.vcr.jam.LoginTask.call(LoginTask.java:29)
         at oracle.webcenter.concurrent.Submission$2.run(Submission.java:484)
         at java.security.AccessController.doPrivileged(Native Method)
         at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
         at oracle.webcenter.concurrent.Submission.runAsPrivileged(Submission.java:498)
         at oracle.webcenter.concurrent.Submission.run(Submission.java:424)
         at oracle.webcenter.concurrent.Submission$SubmissionFutureTask.run(Submission.java:888)
         at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
         at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
         at java.util.concurrent.FutureTask.run(FutureTask.java:138)
         at oracle.webcenter.concurrent.ModifiedThreadPoolExecutor$Worker.runTask(ModifiedThreadPoolExecutor.java:657)
         at oracle.webcenter.concurrent.ModifiedThreadPoolExecutor$Worker.run(ModifiedThreadPoolExecutor.java:682)
         at java.lang.Thread.run(Thread.java:662)
    Caused by: oracle.stellent.ridc.protocol.ProtocolException: java.net.SocketException: Software caused connection abort: recv failed
         at oracle.stellent.ridc.protocol.intradoc.HdaProtocol.readResponse(HdaProtocol.java:254)
         at oracle.stellent.ridc.IdcClient.sendRequest(IdcClient.java:165)
         at oracle.stellent.jcr.IdcPersistenceManagerFactory.createPersistenceManager(IdcPersistenceManagerFactory.java:171)
         ... 15 more
    Caused by: java.net.SocketException: Software caused connection abort: recv failed
         at java.net.SocketInputStream.socketRead0(Native Method)
         at java.net.SocketInputStream.read(SocketInputStream.java:129)
         at com.sun.net.ssl.internal.ssl.InputRecord.readFully(InputRecord.java:293)
         at com.sun.net.ssl.internal.ssl.InputRecord.read(InputRecord.java:331)
         at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:798)
         at com.sun.net.ssl.internal.ssl.SSLSocketImpl.waitForClose(SSLSocketImpl.java:1523)
         at com.sun.net.ssl.internal.ssl.HandshakeOutStream.flush(HandshakeOutStream.java:103)
         at com.sun.net.ssl.internal.ssl.Handshaker.sendChangeCipherSpec(Handshaker.java:689)
         at com.sun.net.ssl.internal.ssl.ClientHandshaker.sendChangeCipherAndFinish(ClientHandshaker.java:985)
         at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverHelloDone(ClientHandshaker.java:904)
         at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:238)
         at com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Handshaker.java:593)
         at com.sun.net.ssl.internal.ssl.Handshaker.process_record(Handshaker.java:529)
         at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:893)
         at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1138)
         at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:753)
         at com.sun.net.ssl.internal.ssl.AppInputStream.read(AppInputStream.java:75)
         at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
         at java.io.BufferedInputStream.read(BufferedInputStream.java:237)
         at oracle.stellent.ridc.common.util.StreamUtil.readRawLine(StreamUtil.java:227)
         at oracle.stellent.ridc.common.util.StreamUtil.readLine(StreamUtil.java:254)
         at oracle.stellent.ridc.protocol.intradoc.HdaProtocol.readHeaders(HdaProtocol.java:453)
         at oracle.stellent.ridc.protocol.intradoc.HdaProtocol.readResponse(HdaProtocol.java:215)
         ... 17 more
    Please let me know the valid Configuration Parameters?
    Thanks,
    Manjunath
    Edited by: 890922 on Oct 30, 2011 8:25 PM

    You need to supply the "Key Store Location", "Key Store Password", "Private Key Alias" and "Private Key Password' to use socketssl.
    Also please make sure that the content server has enabled "Use SSL". You can configure it using the enterprise manager.

  • How to create a DSN-less connection to SQL Server for linked tables in Access

    hey
    i cant understand how i use that Function
    if that information what you need
     stLocalTableName: dbo_user_name
    stRemoteTableName: user_name
    stServer :sedo2015.mssql.somee.com
    stDatabase :sedo2015
    stUsername :sedo_menf_SQLLogin_1
    stPassword :123456789
    how will be that Function??
    please write that Function to me
    '//Name : AttachDSNLessTable
    '//Purpose : Create a linked table to SQL Server without using a DSN
    '//Parameters
    '// stLocalTableName: Name of the table that you are creating in the current database
    '// stRemoteTableName: Name of the table that you are linking to on the SQL Server database
    '// stServer: Name of the SQL Server that you are linking to
    '// stDatabase: Name of the SQL Server database that you are linking to
    '// stUsername: Name of the SQL Server user who can connect to SQL Server, leave blank to use a Trusted Connection
    '// stPassword: SQL Server user password
    Function AttachDSNLessTable(stLocalTableName As String, stRemoteTableName As String, stServer As String, stDatabase As String, Optional stUsername As String, Optional stPassword As String)
    On Error GoTo AttachDSNLessTable_Err
    Dim td As TableDef
    Dim stConnect As String
    For Each td In CurrentDb.TableDefs
    If td.Name = stLocalTableName Then
    CurrentDb.TableDefs.Delete stLocalTableName
    End If
    Next
    If Len(stUsername) = 0 Then
    '//Use trusted authentication if stUsername is not supplied.
    stConnect = "ODBC;DRIVER=SQL Server;SERVER=" & stServer & ";DATABASE=" & stDatabase & ";Trusted_Connection=Yes"
    Else
    '//WARNING: This will save the username and the password with the linked table information.
    stConnect = "ODBC;DRIVER=SQL Server;SERVER=" & stServer & ";DATABASE=" & stDatabase & ";UID=" & stUsername & ";PWD=" & stPassword
    End If
    Set td = CurrentDb.CreateTableDef(stLocalTableName, dbAttachSavePWD, stRemoteTableName, stConnect)
    CurrentDb.TableDefs.Append td
    AttachDSNLessTable = True
    Exit Function
    AttachDSNLessTable_Err:
    AttachDSNLessTable = False
    MsgBox "AttachDSNLessTable encountered an unexpected error: " & Err.Description
    End Function

    thanks more thanks for you
    look i add that code in form
    it worked but i cant add recored  why ??
    Private Sub Form_Open(Cancel As Integer)
    Call AttachDSNLessTable("dbo_user_name", "user_name", "sedo2015.mssql.somee.com", "sedo2015", "sedo_menf_SQLLogin_1", "123456789")
    End Sub

  • Error in wizard to create new RFC model: connect to message server failed

    Hi,
    I am trying to create a new RFC model in my Web Dynpro project in NWDS.  In the wizard, I reach the step where I am required to enter the SAP login information.  I then enter the details in the Load Balancing tab and click Next.  The error message I get is:
    Connect to message server failed
    Connect_PM MSHOST=****, R3NAME=*, GROUP=**
    LOCATION CPIC (TCP/IP) on local host ***
    ERROR service '***" unknown
    (Note: the *** are client-specific and therefore confidential info so I am removing them).
    The thing is, a colleague of mine is also doing the same thing, but he is not encountering this error.
    Can someone help me troubleshoot this?

    Hi
    The user you use to connect in the RFC should have the authorization to S_RFC. In the Duet installation guide look for the section about defining a system user ID in UME. This section has details about the authorization required for the user.
    Thanks

  • Creating a datasource to connect MS SQL server

    I am using CF 7 and trying to create a datasurce to connect
    to my MS SQL server database.
    I get the following error when trying to create a Datasource:
    I have tried using the MS SQL server driver and also using
    Other
    I continue to get the error:
    java.sql.SQLException: [Macromedia][SQLServer JDBC
    Driver][SQLServer]Login failed for user 'trubel'. Reason: Not
    associated with a trusted SQL Server connection.
    The root cause was that: java.sql.SQLException:
    [Macromedia][SQLServer JDBC Driver][SQLServer]Login failed for user
    'trubel'. Reason: Not associated with a trusted SQL Server
    connection.
    Can anyone help me?
    Tim Rubel
    AIM: unixsyadm

    To set up Windows Authentication Mode security with
    Enterprise Manager in SQL Server:
    Expand a server group.
    Right-click a server, and then click Properties.
    On the Security tab, under Authentication, click Windows and
    SQL Server Authentication.
    See
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/instsql/in_runsetup_6p9v. asp
    Ted Zimmerman

  • Creating a TSL/SSL connection to a server

    Hi
    Is it posible to create a TSL/SSL socket connection to a server with as3, webapp, I found SecureSocket but it seems like it is only for Air, and is not in the flex 4.5 sdk?
    Then NetConnection has it, but can you use it with a server that we have created our self? I think I read that if we use flashremoting, we can?
    We are using As3Crypto but there is a lot of overhead on using this, as it is not native code.

    bump

  • Can I create my own iDisk spaces using Lion Server?

    Using Lion Server, can I create a space that would be like iDisk for my users to save and access documents and files remotely? Also to make that shared between users? Basically make my own cloud space.

    SSL Certificate is based on your domain, not the granularity of folders.  If you have a server named idisk.yourdomain.com and all users will access the same domain, than you need a cert for idisk.yourdomain.com.  If you plan to do multiple hosts within the same domain, such as idisk.yourdomain.com and clouddrive.yourdomain.com then look to get a wildcard cert.  If you are doing multiple domains, such as idisk.yourdomain.com and clouddisk.otherdomain.com then you need multiple certs.  One per domain.
    As for access control, that is handled through folder structure and permissions.  Make two folders.  AllAccess and LimitedAcces.  You can make a group that contails users A, B, and C and make them part of a group.  That group can access the AllAccess folder.  Then make another group containing users A & B and then grant them access to the LimitedAccess folder.

  • How can I create a Pooled VDI infraestructure using Win server 2012 as VM image?

    Hello
    I have followed the "usual" way to build a pooled VDI desktop using Win7 or Win8 with success, but it fails when I use an image of Win Server 2012 as VM instead. 
    Am I overlooking something?  Should I need to prepare the image in a different way? (Sysprep differently?)
    Thanks

    Dear Ryan
    I think the point is other than committing a breach of licensing.  I have a legitimate need to use a pooled server system, which incidentally is not going to be end user.
    The "economy" of the proposed structure can make a more efficient use of the equipment.
    This is an excerpt of the MS VDI Q&A:
    Do I need to pay for Windows VDA if I use Windows Server as a client operating system in my virtual machine?
    OR
    I’ve heard that I can avoid paying for Windows VDA by using Windows Server as my VDI desktop OS. Is this true?
    Running a Windows Server®
    OS as the desktop in the datacenter does not require Windows VDA, but there are many reasons why a server OS should not be used as a desktop, especially in the datacenter:
    The user experience with servers as the desktop is very different from using a Windows client.
    Many applications for end users were written for a client OS and not a server OS. Each of your applications would need to be retested to ensure compatibility with a server OS. Additionally, most vendors
    do not offer support for client applications running on servers.
    Clients and servers are on different patch cycles, adding to management complexity.
    Most of the VDI ecosystem will support the Windows client in the datacenter, not server OS’s.
    However, if you do decide to run a server OS as the desktop, please note that you will need to pay a Remote Desktop Services Client Access License (RDS-CAL) to correctly license that scenario.

  • Creating Point-to-Multipoint connection using Bluetooth

    Hi,
    I have a problem with my application. It's supposed to be a part of a Bluetooth multiplayer game responsible for data exchange between devices. I created it based on the code from
    [http://www.forum.nokia.com/info/sw.nokia.com/id/2b17fb6f-b9a4-4cd8-80fd-94b8251a048e/Games_Over_Bluetooth_v1_0_en.zip.html]
    The part of the code responsible for detecting devices and connecting with them works just fine both on the emulator and real devices. The data exchange works perfectly on my Netbeans 6.5.1 and WTK 2.5.2 in the default emulator, but the problems arise when try to run it on SE C905, Nokia N73 and Nokia 5530 XpressMusic (it doesn't work even between any two devices).
    The data exchange should look like this:
    1. Send data from clients to the server -> 2. server receives the data -> 3.Server sends combined data from all clients to each client-> 4. clients receive the combnied data -> go back to 1.
    The problem on the real devices is that the connection is opened but data is not exchanged. The first piece of data is sent from the client and received by the server, but after that nothing gets received.
    It gets lost somewhere... The data is exchanged in DataExchange inner class
    I would be very grateful for any help
    Here's my code:
    Client:
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.OutputStream;
    import javax.bluetooth.*;
    import javax.microedition.io.*;
    import javax.microedition.lcdui.*;
    import javax.microedition.midlet.*;
    * @author Zawada
    public class MultiClient extends MIDlet implements CommandListener {
        private Display display;
        private Form clientForm;
        private Command exitCommand;
        private LocalDevice local_device;
        private DiscoveryAgent disc_agent;
        private String service_UUID;
        private String player_name;
        private String url;
        private StreamConnectionNotifier notifier;
        private StreamConnection con;
        private InputStream is;
        private OutputStream os;
        private boolean isConnectionActive = false;
        private String message = "5678";
        private Thread dataExchange;
        public MultiClient() {
            display = Display.getDisplay(this);
            clientForm = new Form("Bluetooth Client");
            clientForm.append("Application started\n\n");
            exitCommand = new Command("Exit", Command.EXIT, 1);
            clientForm.addCommand(exitCommand);
            clientForm.setCommandListener(this);
        public void startApp() {
            display.setCurrent(clientForm);
            try {
                setUpClient();
            } catch (IOException ex) {
                ex.printStackTrace();
        public void pauseApp() {
        public void destroyApp(boolean unconditional) {
            isConnectionActive = false;
            if (is != null & os != null & con != null) {
                try {
                    // Multiplayer session is stopped: Disconnect the devices
    // close input stream
                    is.close();
    // close output stream
                    os.close();
    // Close connection
                    con.close();
                } catch (IOException ex) {
                    ex.printStackTrace();
            notifyDestroyed();
        public void commandAction(Command c, Displayable d) {
            if (c == exitCommand) {
                destroyApp(true);
        private void setUpClient() throws IOException {
            try {
                // Obtain local device object
                local_device = LocalDevice.getLocalDevice();
    // Obtain discovery agent object
                disc_agent = local_device.getDiscoveryAgent();
    // Set device into limited access mode. Inquiry scan
    // will listen only to LIAC.
                local_device.setDiscoverable(DiscoveryAgent.GIAC);
    // Do the service search on all found devices.
    // Note: don’t use this UUID in your own MIDlets.
    // You have to create an own UUID for each MIDlet that you write:
                service_UUID = "F0E0D0C0B0A000908070605040302010";
    // Retrieve players name
    // This could be a name that user has modified and stored to
    // non-volatile memory. As default (when game is first started)
    // the local friendly name could be chosen.
                player_name = "Ziom";//local_device.getFriendlyName();
    // Open connection, note: name is attribute ID 0x0100
                url = "btspp://localhost:" + service_UUID + ";name=" + player_name;
                notifier = (StreamConnectionNotifier) Connector.open(url);
    // Wait on someone to connect (note: you can cancel this wait
    // only if you call notifier.close() from another thread.
    // This is important if you want to offer a UI for the user
    // to cancel connections setup.)
                con = (StreamConnection) notifier.acceptAndOpen();
    // open input stream
                is = con.openInputStream();
    // open output stream
                os = con.openOutputStream();
                clientForm.append("Connection opened\n");
    // Devices are connected now:
    // Run the game / exchange data ...
                dataExchange = new DataExchange();
                dataExchange.start();
            } catch (BluetoothStateException ex) {
                ex.printStackTrace();
        private class DataExchange extends Thread {
            private byte[] sentData;
            private byte[] receivedData;
            public DataExchange() {
                isConnectionActive = true;
            public void run() {
                int j = 0;
                while (isConnectionActive == true) {
                    try {
                        sentData = message.getBytes();
                        os.write(sentData);
                        System.out.println("data written: " + new String(sentData));
    //                        clientForm.append("Data sent\n");
                        int lengthavai = 0;
                        //wait till having received data from the server
                        while ((lengthavai = is.available()) <= 0) {
    //                        clientForm.append("Waiting for data\n");
                        receivedData = new byte[lengthavai];
                        int length = is.read(receivedData);
                        System.out.println("data read: " + new String(receivedData));
                        clientForm.append(new String(receivedData));
                    } catch (IOException ex) {
                        clientForm.append("IO ex\n");
                        ex.printStackTrace();
                    j++;
    }

    Server:
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.util.Enumeration;
    import java.util.Vector;
    import javax.bluetooth.*;
    import javax.microedition.io.Connector;
    import javax.microedition.io.StreamConnection;
    import javax.microedition.lcdui.*;
    import javax.microedition.midlet.*;
    * @author Zawada
    public class MultiServer extends MIDlet implements CommandListener {
        private Display display;
        private Form serverForm;
        private Command exitCommand;
        private LocalDevice local_device;
        private String url;
        private StreamConnection[] con;
        private InputStream[] is;
        private OutputStream[] os;
        private String message = "1234";
        private boolean isConnectionActive = false;
        private UUID[] u;
        private int numberOfClients;
        private Thread dataExchange;
        public MultiServer() {
            display = Display.getDisplay(this);
            serverForm = new Form("Bluetooth Server");
            serverForm.append("Application started\n\n");
            exitCommand = new Command("Exit", Command.EXIT, 1);
            serverForm.addCommand(exitCommand);
            serverForm.setCommandListener(this);
        public void startApp() {
            display.setCurrent(serverForm);
            System.out.println("5678".getBytes().length);
            try {
                setUpServer();
            } catch (BluetoothStateException ex) {
                serverForm.append("BT ex\n");
                ex.printStackTrace();
            } catch (InterruptedException ex) {
                serverForm.append("Interr ex\n");
                ex.printStackTrace();
            } catch (IOException ex) {
                serverForm.append("IO ex\n");
                ex.printStackTrace();
        public void pauseApp() {
        public void destroyApp(boolean unconditional) {
            isConnectionActive = false;
    // Multiplayer session is stopped: Disconnect the devices
            for (int i = 0; i < numberOfClients; i++) {
                try {
                    if (is != null & os != null & con != null) {
    // close input stream
                        is.close();
    // close output stream
    os[i].close();
    // Close connection
    con[i].close();
    } catch (IOException ex) {
    ex.printStackTrace();
    notifyDestroyed();
    public void commandAction(Command c, Displayable d) {
    if (c == exitCommand) {
    destroyApp(true);
    private void setUpServer() throws BluetoothStateException, InterruptedException, IOException {
    // Obtain local device object
    local_device = LocalDevice.getLocalDevice();
    // Obtain discovery agent object
    DiscoveryAgent disc_agent = local_device.getDiscoveryAgent();
    // Disable page scan and inquiry scan
    local_device.setDiscoverable(DiscoveryAgent.NOT_DISCOVERABLE);
    // create inquiry listener object
    InquiryListener inq_listener = new InquiryListener();
    synchronized (inq_listener) {
    // start a limited access inquiry and install inquiry listener
    disc_agent.startInquiry(DiscoveryAgent.GIAC, inq_listener);
    serverForm.append("Inquiry started\n");
    // Wait
    inq_listener.wait();
    serverForm.append("Inquiry ended\n");
    // Do the service search on all found devices
    u = new UUID[1];
    // Note: don’t use this UUID in your own MIDlets.
    // You have to create an own UUID for each MIDlet that you write:
    u[0] = new UUID("F0E0D0C0B0A000908070605040302010", false);
    int attrbs[] = {0x0100};
    // Retrieved service record should include player
    // name (service name)
    Enumeration devices = inq_listener.cached_devices.elements();
    serverForm.append("Number of devices found: " + inq_listener.cached_devices.size() + "\n");
    ServiceListener serv_listener = new ServiceListener();
    while (devices.hasMoreElements()) {
    synchronized (serv_listener) {
    // on each device do a service search
    disc_agent.searchServices(attrbs, u, (RemoteDevice) devices.nextElement(), serv_listener);
    serverForm.append("Service inquiry started\n");
    // Wait
    serv_listener.wait();
    serverForm.append("Service inquiry ended\n");
    // Now all devices which offer the requested service (game)
    // can be found in the serv_listener.FoundServiceRecord list.
    // This list would now be presented to the user and user can filter
    // this list/ select one or more devices to connect to.
    // Or in other words: remove all devices from FoundServiceRecords
    // list that you don't want to connect to.
    // Here we just print all the (remote) player names
    numberOfClients = serv_listener.FoundServiceRecords.size();
    serverForm.append("Number of clients: " + numberOfClients +"\n");
    String player_name;
    for (int i = 0; i < numberOfClients; i++) {
    // Retrieve player name which is contained as service name
    // (0x0100) in the service record
    player_name = (String) ((ServiceRecord) serv_listener.FoundServiceRecords.elementAt(i)).getAttributeValue(
    0x0100).getValue();
    // print name
    System.out.println(player_name);
    // After filtering these devices will be connected:
    con = new StreamConnection[numberOfClients];
    is = new InputStream[numberOfClients];
    os = new OutputStream[numberOfClients];
    for (int i = 0; i < numberOfClients; i++) {
    // Retrieve url for one device/service
    url = ((ServiceRecord) serv_listener.FoundServiceRecords.elementAt(i)).getConnectionURL(ServiceRecord.AUTHENTICATE_ENCRYPT, false);
    // Open connection
    con[i] = (StreamConnection) Connector.open(url);
    // open input stream
    is[i] = con[i].openInputStream();
    // open output stream
    os[i] = con[i].openOutputStream();
    serverForm.append("Connection " + i + " opened\n");
    // Devices are connected now:
    // Run the game / exchange data ...
    dataExchange = new DataExchange();
    dataExchange.start();

  • Creating a reliable network connection using WiFi

    Hi there,
    I have 2 iMacs running Maverick. I have a home Wifi network and I am trying to create a reliable connection between the 2 computers.
    The wifi signal at both locations is strong although in 2 different buildings i.e. house and studio.
    I currently have them networked but is very unreliable and I am not sure if there is some type of sleep mode or something that cause them to stop communicating.
    Basically I go to Finder -> Go -> Connect to Server everytime I need to re-establish the connection.
    Ideally I would like the connection to be permanent and auto restore if connection is lost.
    Is this possible and could you walk me throught the steps and any settings I should be aware of?
    Thanks

    Contact with Zaitek coveraged and Communications solutions, they have a wide range of  VoIP service. I have been using their services at my office since a year ago. Nice
    http://www.zaitekdmv.com/

  • User created SQL Agent Job that uses linked server with Windows authentication

    OK, here's what I want to do, but not sure exactly what I need to accomplish it.
    Environment
    Windows 2008 Enterprise
    SQL 2012 Enterprise
    SQL Server & SQL Agent running under AD account (which has local Windows Administrative privileges...yes, I know..bad!)
    Linked server to Teradata utilizing AD account mappings (the linked server works successfully and each windows login is mapped to a Teradata LDAP login)
    Requirement
    Allow non sysadmins to create SQL Agent jobs which execute TSQL statements which use OPENQUERY(LDAPLinkedServer, '....) syntax
    I've already given the non sysadmins the necessary permissions to create and run SQL Agent jobs, and I understand that the jobs run under their login context, but I suspect that I'm missing something when it comes to the linked server.
    Each windows user could have access to different databases/tables on the Teradata system that even I (the SQL Server sysadmin) don't have access to.
    How can I facilitate this functionality?  Any ideas?

    I think I may have been over complicating the Teradata piece.  The authentication methodology in Teradata is LDAP, which just means that it authenticates against AD, but you still have to submit your Windows login & password.  It doesn't automatically
    authenticate you just because you're logged into Windows.  
    The linked server has the mapping for the individual windows logins like:
    Local Login = <domain>.<windows id>
    Remote User = <windows id>
    Remote Password = <windows password>
    This setup requires the user to have to change the passwords in the linked server whenever they change their passwords according to domain policy (every xx days)...but we've created a utility proc that they can use to do this.
    So, I'm thinking that Teradata isn't really part of this equation.

  • How to create a composite nonclustered index using sql server management studio

    Hi,
    How do I create a composite non clustered index using Manage Index and Keys dialogue box?
    sukai

    See image below:
    Kalman Toth Database & OLAP Architect
    SQL Server 2014 Database Design
    New Book / Kindle: Beginner Database Design & SQL Programming Using Microsoft SQL Server 2014

  • Forms6i Connectivity using Directory Server

    I installed directory server in my organisation to centralize the service names. When i connect with db using 9i SQL prompt it works fine but when i try to connect through froms 6i the connection does not go through. I placed LDAP and SQL NET files in the NET80 ----- ADMIN folder
    Any idea

    Hi, try to ask at Sun Java System Directory Server forum:
    http://swforum.sun.com/jive/forum.jspa?forumID=13

Maybe you are looking for

  • Vendor return via delivery, material sales view needed?

    Hi, We wish to retur material to vendor via Delivery process Return PO --> Delivery -->  Goods issue We ticketed 'Return to Vendor' checkbox, we created ship-to customer and saved Vendor now my question is Do we need create material master sales view

  • Ken Burns Affect does not work....

    Ok, these are the steps that I'm taking to work with my photos. I import them and wait untill they render, and once they are finished rendering I move them down to the timeline. I then press the tab for pictures and it gives me the button for ken bur

  • Certificates downloading to any machine a valid user connects to the wireless

    We are set up to download a certificate to PCs over wireless when the user is validated.  No one has ever explained the point of that. It seems like you  do not have 2 factor authentication if you give the second factor away after the first is authen

  • Time Machine Lost After Installing Windows

    Last night I installed Windows XP using Boot Camp. Everything went great and Windows ran perfectly....well it is Windows so it ran okay. Now I noticed that I have an icon for the Mac HD like always and a new icon for the Windows partion (Untitled). N

  • Time Machine failing  (10.7.2)

    After restarting time machine several times never passing some  400 KB of a +4 GB backup, I went for the preferences and got this one Yet another reboot...