Building a simple J2ME chat client (for own J2SE-based server) Threading Qs

Hi!
I am making my own simple chat / messenger service to use between a couple of friends over GPRS.
On the server side i have made a multi threaded TCP server that opens a new thread for each connecting client and stores these socket connections in a hashtable for access to send data between each thread.
So when a client logs on to the server, the server sends a printwriter message to all other clients informing them of what client connected, and the clients can put the username in its out-database. then the clients can send messages to each others using a simple, self build protocol.
All connection between clients/server happens over a simple printwriter on in/out streams.
Problem is: it works perfectly most of the time.... However, sometimes a message is mysteriously lost when transferred from the server to a client. Transfer from client to server works flawlessly. I am thinking that it might have something to do with the client side threading, or slow network transfer casuing a TCP read error.
Client structure is as following:
start-> Midlet class -> (press connect to server) -> new Client class (impl runnable) -> new thread(this) -> void run() sets up all connections and writers, waits in a while loop for messages from server and takes action according to message type. -> Button(send) uses output stream to send a message to server.
Do anyone have any suggestions on what I must consider when making a client that will simultaniously be able to listen for data from server as well as send data to server over 1 socket and slow mobile connection without causing any trouble?
More info can be provided if necessary.
Thank you!

Building a simple J2ME chat client (for own J2SE-based server)a. i would like to say that this is a bl00dy brilliant idea. i mean ~ its been done before but building one yourself is quite thrilling.
b. are u using java 4 or java 5. ?
sometimes a message is mysteriously lost when transferred from the server to a client. Transfer from client to server works flawlessly.are you using push registry to recieve incoming connections.
i recommend using a StreamConnectionNotifier connection instead of just a socket connection. you could send your data (xml/plain text) just like a stream (tcp ofcourse). if you want to know how to use a StreamConnectionNotifier connection, here's how
try{
// listen at local port 789
StreamConnectionNotifier notify = (StreamConnectionNotifier) Connector.open(“http://:789”);
// infinite loop to get incoming connections
for(;;)
StreamConnection stream = notify.acceptandOpen();  // return a stream connection when a connection is made
InputStrean mystream = stream.openInputStream();
while(mystream!=-1)
mystream.read();
....cheers

Similar Messages

  • Is there a chat client for the iPod Touch or iPhone yet?

    Is there a chat client for the iPod Touch or iPhone yet? I already know about Meebo and JiveTalk which allow me to chat on all the major clients, Yahoo, MSN, and AOL. But how about a standalone app?
    Thanks,
    Jeff

    And so when are we talking about here? That one app and then I think this thing will be complete! Well I suppose we could use another food processor, garbage disposal, answering machine, music player, Swiss Army knife. But I'll be happy if I can just chat with friends!
    Thanks!
    Jeff

  • Oracle Client for Windows 2008 R2 server to connect to Oracle database 9iR2

    Hi,
    We are running Oracle 9.2.0.7 on Sun solaris (64 Bit) 5.10 and trying to install client on new Windows 2008 R2 (64 - bit) server. (Before this 2008 R2 we were using Windows 2003 32 bit and 9iR2 client was working great.) I can't install 9iR2 clinet and I tried installing 10gR1, 10gR2 and 11gR1 but none of them worked. It is only allowing me to install 11gR2. When I installed 11gR2 client I am getting some 'overflow exception on an arithmetic operation' error.
    1.) Do I have any choice for client installation or only 11gR2?
    2.) Any solution for overflow error?
    Thanks,
    -H

    May I know the reason why ODBC driver is not include in option like Runtime?Oracle software utilizes SQL*Net (not ODBC) to connect to Oracle RDBMS.
    ODBC is not required by Oracle client software to connect to Oracle RDBMS.

  • Terminal Keyboard features for a Linux based Server System

    Hi Forum,
    there are some highlighted characters within terminal functions at a linux server (redhat or suse or ...) With Putty or a linux connection I get the special keys that are highlighted to work with the "alt" key pressed. Example is the terminal button "ok" with the "o" highlighted. If I press "alt"+"o" it would be choosen and the next page will be shown. Is there a way to make this work on a MacOSX Terminal? I had no chance to find anything similar with google. I hope you might find a solution!
    Thank you and best regards,

    Post Unix and Terminal queries to the Unix forum under OS X Technologies where those mavens frolic.

  • Cmd-line client for web service

    Hi there,
    I'm new to Sun Java Studio, but generally familiar with the technology. So far I managed to build a web service and to register it.
    Now I would like to build a simple cmd-line client to invoke this web services. I couldn't find anything in the "documentation" or "tutorial". Does anybody has some sample code?
    Thanks,
    Andreas

    The tutorial http://www.netbeans.org/kb/50/quickstart-webservice-client.html provides a sample for developing a standalone client that consumes a webservice.
    The tutorial is for NetBeans 5.0 (http://www.netbeans.info/downloads/download.php?type=5.0) but should be applicable for JSE8 (based on NB4.1).

  • Setting up BCM 7.0.6.100 Internet Chat Client

    Hi, everyone!
    I've been struggling with a weird error message when setting up the proof-of-concept chat client for BCM 7.0.6.100
    What I did is set up a fresh system from scratch and configure it just enough to conduct tests. After that I installed the chat client onto the same machine.
    Now the problem is that whenever I rty to initiate a new chat I get the following error message:
    13Chat Server not availablefalse
    System.Web.Services.Protocols.SoapException: com.sap.bcb.common.SoapException
       at ChatPortal.IciContainerService.subscribe(String appUrl, String appId, String channelType, String containerId) in d:\bcm_70_sp6_p1_source\bcm_7\source\source\ExtAppIntegration\WebServices\ChatPortal\IciContainerService.asmx.cs:line 99
    This is a copy-paste from the exact message. Chat server actually is available and I'm pretty much out of ideas what to try to fix.
    Has anyone any ideas on what to try next to get the chat working or better yet does anybody know the exact solution?
    Thanks in advance,
    Jaanus

    Jaanus,
    can you reach this page?
    If "Yes", and after clicking "Submit" you get an error message, check contact filed, e-mail ([email protected] on the screenshot) address must be the same as you assigned to a chat queue.
    BR,
    Anton.

  • Simple application using WebDynpro for ABAP

    Hi All,
    I want to Build a simple application using WebDynpro for ABAP..
    Thank you,
    Karan

    Hi Mr.Karan,
    Pls Go through the link [Application|http://****************/Tutorials/WebDynproABAP/SimpleApplication/SimpleApp1.htm]..
    Let me know if need any help...
    Thank you,
    Srini.S

  • Simple Chat Client using Java

    Hi again. I'm thring to implement a simple chat client into my game and I need some help coding it, because it's way over my head. lol thanks

    Well, you have left your question very vague, and people tend to get irritated by it. First of all, you need to really specify what you need. If you have nothing and need everything....you need to start by thinking about what methods will be used to send the messages...the GUI should be the last part. Do you need a server, plan on using a public server, or in a LAN environment. If you need a server, what type? Do you plan on writing your own?
    For example, if you wanted to use an IRC server as your server, you could use PircBot as your backend for the communication and then integrate that into a GUI. If you wanted AOL, there are packages out there you can use.
    If you have things thought out, you need to tell us what you are really asking and what you aready have. Otherwise, you have a lot of things to think about.

  • Build and Capture task sequence fails at 'Prepare ConfigMgr Client for Capture' step

    The scenario is as follows:
    Task Sequence is a Build and Capture of Windows 7 SP1 x64 Enterprise
    There are 17 Applications installed split into 2 'Install Application' steps due to the 9 item limit
    129 Software Updates are installed
    SCCM 2012 RTM
    I have built and captured on this system previously however there were no 'applications', just traditional SCCM 'packages'
    All task sequence steps run successfully until it gets to the 'Prepare ConfigMgr Client for Capture' step and it fails here. Here are the relevant parts of the SMSTS.log file:
    <![LOG[No certificates to delete]LOG]!><time="15:30:12.531-660" date="11-13-2012" component="PrepareSMSClient" context="" type="1" thread="2880" file="preparesmsclient.cpp:1013">
    <![LOG[Deleting Client properties from file C:\Windows\SMSCFG.INI succeeded.]LOG]!><time="15:30:12.531-660" date="11-13-2012" component="PrepareSMSClient" context="" type="1" thread="2880" file="preparesmsclient.cpp:922">
    <![LOG[Reseting the Trusted Root Key successful]LOG]!><time="15:30:12.531-660" date="11-13-2012" component="PrepareSMSClient" context="" type="1" thread="2880" file="preparesmsclient.cpp:1088">
    <![LOG[Deleting instance of 'CCM_Client' successful]LOG]!><time="15:30:12.531-660" date="11-13-2012" component="PrepareSMSClient" context="" type="1" thread="2880" file="preparesmsclient.cpp:170">
    <![LOG[Successfully reset Registration status flag to "not registered"]LOG]!><time="15:30:12.531-660" date="11-13-2012" component="PrepareSMSClient" context="" type="1" thread="2880" file="preparesmsclient.cpp:309">
    <![LOG[Successfully disabled provisioning mode.]LOG]!><time="15:30:12.546-660" date="11-13-2012" component="PrepareSMSClient" context="" type="1" thread="2880" file="preparesmsclient.cpp:1273">
    <![LOG[Start to cleanup TS policy]LOG]!><time="15:30:12.546-660" date="11-13-2012" component="PrepareSMSClient" context="" type="0" thread="2880" file="utils.cpp:2773">
    <![LOG[getPointer()->ExecQuery( BString(L"WQL"), BString(pszQuery), lFlags, pContext, ppEnum ), HRESULT=ffffffff (e:\nts_sccm_release\sms\framework\core\ccmcore\wminamespace.cpp,389)]LOG]!><time="15:35:21.000-660" date="11-13-2012" component="PrepareSMSClient"
    context="" type="0" thread="2880" file="wminamespace.cpp:389">
    <![LOG[ns.Query(sQuery, &spEnum), HRESULT=ffffffff (e:\nts_sccm_release\sms\framework\tscore\utils.cpp,2800)]LOG]!><time="15:35:21.000-660" date="11-13-2012" component="PrepareSMSClient" context="" type="0" thread="2880" file="utils.cpp:2800">
    <![LOG[Wmi query 'select * from CCM_Policy where PolicySource = 'CcmTaskSequence'' failed, hr=0xffffffff]LOG]!><time="15:35:21.000-660" date="11-13-2012" component="PrepareSMSClient" context="" type="3" thread="2880" file="utils.cpp:2800">
    <![LOG[End TS policy cleanup]LOG]!><time="15:35:21.000-660" date="11-13-2012" component="PrepareSMSClient" context="" type="0" thread="2880" file="utils.cpp:2821">
    <![LOG[TS::Utility::CleanupPolicyEx(false), HRESULT=ffffffff (e:\nts_sccm_release\sms\client\osdeployment\preparesmsclient\preparesmsclient.cpp,457)]LOG]!><time="15:35:21.000-660" date="11-13-2012" component="PrepareSMSClient" context="" type="0" thread="2880"
    file="preparesmsclient.cpp:457">
    <![LOG[Failed to delete policies compiled by TaskSequence (0xffffffff)]LOG]!><time="15:35:21.000-660" date="11-13-2012" component="PrepareSMSClient" context="" type="3" thread="2880" file="preparesmsclient.cpp:457">
    <![LOG[Failed to prepare SMS Client for capture, hr=ffffffff]LOG]!><time="15:35:21.000-660" date="11-13-2012" component="PrepareSMSClient" context="" type="3" thread="2880" file="preparesmsclient.cpp:472">
    <![LOG[pCmd->Execute(), HRESULT=ffffffff (e:\nts_sccm_release\sms\client\osdeployment\preparesmsclient\main.cpp,136)]LOG]!><time="15:35:21.000-660" date="11-13-2012" component="PrepareSMSClient" context="" type="0" thread="2880" file="main.cpp:136">
    <![LOG[Failed to prepare SMS Client for capture, hr=ffffffff]LOG]!><time="15:35:21.000-660" date="11-13-2012" component="PrepareSMSClient" context="" type="3" thread="2880" file="main.cpp:136">
    <![LOG[Process completed with exit code 4294967295]LOG]!><time="15:35:21.015-660" date="11-13-2012" component="TSManager" context="" type="1" thread="2152" file="commandline.cpp:1098">
    <![LOG[!--------------------------------------------------------------------------------------------!]LOG]!><time="15:35:21.015-660" date="11-13-2012" component="TSManager" context="" type="1" thread="2152" file="instruction.cxx:3011">
    <![LOG[Failed to run the action: Prepare ConfigMgr Client for Capture. 
    Unknown error (Error: FFFFFFFF; Source: Unknown)]LOG]!><time="15:35:21.046-660" date="11-13-2012" component="TSManager" context="" type="3" thread="2152" file="instruction.cxx:3102">
    It looks like there is a similar issue over here (http://www.windows-noob.com/forums/index.php?/topic/5906-task-sequence-error-0xffffffff/) that was resolved by removing the Application Installations one by one until a problematic one was found
    and removed - however I would rather avoid this very time consuming process if possible.
    I have also testing this using 'capture media' in the full OS and that also fails at the same step with the same errors in the smsts.log
    The only workaround I have for now is to let the task sequence fail at the 'Prepare ConfigMgr Client for Capture' step, then I uninstall the SCCM client using 'ccmsetup.exe /uninstall' and use the 'capture media' method - obviously with no SCCM client installed,
    it skips the 'Prepare ConfigMgr Client for Capture' step and goes straight to the 'Prepare OS' step and then to the actual capture to the WIM step.
    Anybody else seeing this or have any suggestions?
    My Microsoft Core Infrastructure & Systems Management blog -
    blog.danovich.com.au

    It looks like there is a similar issue over here (http://www.windows-noob.com/forums/index.php?/topic/5906-task-sequence-error-0xffffffff/) that was resolved by removing the Application Installations one by one until a problematic one was found
    and removed - however I would rather avoid this very time consuming process if possible.
    You dont have to test it 18 times....
    Just test with 50% of the applications first, if it fails, test with 25% and then on of the time...
    You should be able to find the application, within 4-5 tests...
    Ronni Pedersen | Microsoft MVP - ConfigMgr | Blogs:
    http://www.ronnipedersen.com/ and SCUG.dk/ | Twitter
    @ronnipedersen

  • Creating a simple java client for a session EJB local interface

    Hi all
    Is it possible to create a simple java client for a session ejb local interface with JDeveloper.
    The problem is that it creates a test client for a remote interface only...
    i.e.
    MySessionEJB sessionEJB = context.lookup("MySessionEJB")
    and once i try to adjust it manually for the local interface...
    MySessionEJBLocal sessionEJB = (MySessionEJBLocal) context.lookup("MySessionEJBLocal") (MySessionEJBLocal - is the name of my local interface)
    it generates the exception:
    javax.naming.NotFoundException: SessionEJBLocal not found
    at...........................(RMIClientContext.java:52)
    There is still no problem with accessing the local interface object from the jsf project where i've added <ejb-local-ref> tag into the web.xml file.
    but i need the possibility of testing the simple java client for the local interface to test business methods wich should return objects without indirect properties
    Thanks in advance.
    Alex.

    Pedja thanks for reply.
    I still dont understand what is wrong with my example.
    The first peace of the code i wrote (getting the reference to the remote interface object) works pretty well, and even more it is produced automatically by JDeveloper, so why we cant get a reference to the local interface object the same way?
    Certanly we should use the local interface for getting access to the resource functioning under the same local jvm and i think it doesnt metter wich app server we really use wls or oas or others
    Thanks. Alex.

  • Any simple program available for testing instant client for Windows

    Any simple program available for testing installation of instant client for Windows.
    Thankx in advance

    Having a program means you need a dev environment to compile, link and then test it with your instant client env.
    I would suggest you download sqlplus ZIP and connect to a DB server.

  • Client for Second Life and/or Voice chat ?

    Is there a client for Second Life and/or Voice chat ?

    Yes, the app is called Pocket Metaverse. There is a free version and a Pro Version that costs $2.99.

  • Building JAX-WS Clients for Oracle Cloud Applications

    Hello,
    We are looking for a tutorial on how to build JAX-WS clients for Oracle Cloud Applications using Eclipse and OEPE.
    Do you know if there is any document about this, or any document that can help us on this task.
    Thanks and regards,
    Gustavo.

    A JAX-WS web service client with OEPE would be the same for a cloud service.
    https://docs.oracle.com/cd/E15315_09/help/oracle.eclipse.tools.weblogic.doc/html/webservices/start.html
    For developing for Oracle Cloud refer
    https://apex.oracle.com/pls/apex/f?p=44785:24:100395514147349::NO::P24_CONTENT_ID%2CP24_PREV_PAGE:7026%2C2

  • TCP or UDP for chat client?

    Which is the best method of creating a chat client?
    Should I use TCP or UDP
    UDP seems like the best way to broadcast but TCP is more reliable.
    Any advice would be greatly appreciated
    Cheers
    Rob

    Well, for just a chat client, you don't need either - because there is no communication. But I'll take it that you want to implement client/server communications - a chat application.
    The answer is: it depends on how much work you want to do.
    o UDP is very low level. You can send and receive datagrams, and the rest is up to you. Example: Do you care if messges get lost? Do you care about really long messages? If you use UDP, then you will have to implement those things you care about yourself.
    (Haven't really thought qbout multicast for a chat system. Might work, and then UDP is your only option.)
    o TCP lets you send and receive messages point-to-point; no messages will ever be lost, and you can send large blocks of data.
    However for both UDP and TCP, you have to invent most of the application-level protocol your self.
    o Another option that a lot of people choose is RMI. This allows you to concentrate on application design, and not worry - theory anyhow - about much communications design. (Reality is somewhat otherwise, because RMI is very fussy to get set up to work properly.)
    Hope this helps.

  • Building WSDL client for OIM SPML webservice

    Has any one created WSDL client for OIM SPML webservice,
    Any help is appreciated.
    Thanks,
    Pandu
    old thread -->
    add udfs to spml prov. request to oim
    ==========================
    Hi,
    I am provisioning users in OIM from by sending spml requests
    I used the sample client that comes in xellerate directory.
    How can I update spml requests to include UDFs to create user in him with udf s.
    Thanks
    Pandu
    Edited by: pandu345 on Aug 5, 2009 3:27 PM

    Hello there,
    There is a .NET web service client which is successfully able to access the weblogic application server wsdl from oim 9101 and it can see the complete user profile as a response from the same.
    1.) Now, there is a situation where oim needs to send some attribute values to that .NET web service client, after the data from their side comes to OIM and updates a single attribute values for e.g. PIN. How can we do that ?
    2.) and I want to add some UDFs into the existing SPML provisioning user profile. How can I do that ?
    3.) Also, how will OIM know that it was able to successfully send the attribute values to the web service client.
    http://download.oracle.com/docs/cd/E10391_01/doc.910/e10360/creategtc.htm#Toc153968032
    I have gone through this. I didnt found this in OIM 9101.
    Any ideas/references/clues/hints appreciated in this concern.
    Thanks in advance,
    - oidm.

Maybe you are looking for