DatagramSocket API and ServerSocket API

Based on the release notes of 11.8, the DatagramSocket APIs is now supported on iOS.
This API is not in the playerglobal.swc available for download @ http://labsdownload.adobe.com/pub/labs/flashruntimes/flashplayer/flashplayer11-8_playerglo bal.swc
How can I access this API ?
Reference: http://labsdownload.adobe.com/pub/labs/flashruntimes/shared/air3-8_flashplayer11-8_release notes.pdf
Thanks.
Guillaume

These APIs are already present in AIR desktop.  These will not be available in Flash Player because of the security implications in the context of a web browser running untrusted/unsigned content.
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/DatagramSocke t.html
The DatagramSocket class enables code to send and receive Universal Datagram Protocol (UDP) packets.
AIR profile support: This feature is supported on all desktop operating systems, but is not supported on mobile devices or AIR for TV devices. You can test for support at run time using the DatagramSocket.isSupported property. See AIR Profile Support for more information regarding API support across multiple profiles.
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/ServerSocket. html
The ServerSocket class allows code to act as a server for Transport Control Protocol (TCP) connections.
AIR profile support: This feature is supported on all desktop operating systems, but is not supported on mobile devices or AIR for TV devices. You can test for support at run time using the ServerSocket.isSupported property. See AIR Profile Support for more information regarding API support across multiple profiles.

Similar Messages

  • DatagramSocket.receive() and Thread.interrupt() - Inconsistent behavior

    Hi,
    I currently have an application that does in a seperate Thread receive udp packets in a loop around a Datagramsocket.receive(). Whenever a state change should occur, the thread is being interrupted by Thread.interrupt() in order to exit the DatagramSocket.receive().
    That works nicely on the solaris version of the jvm (1.5.0-11) on x86 and sparc but it does not work on linux intel (i386 and amd64). There the receive simply ignores the interrupt.
    What is the intended behavior ?
    Do I have to move to timeOuts on each receive (which hinders fast state changes as timeouts have to occur and the loop has to be timeouted very often in order to be fast).
    Little tests say: (java 1.5)
    Linux 2.6.18 (32/64 Bit) : no interrupt
    FreeBsd (32/64 Bit): interrupt works
    Solaris 10 (sparc/64x86): interrupt works
    MacOs 10.4: no interrupt
    On Linux 2.6.18, java 1.4 - interrupt works.
    At least a consistent behavior is missing!
    J�rn
    Here is the code:
    SubThread.java:
    package test;
    import java.net.*;
    import java.io.*;
    public class SubThread extends Thread {
         public DatagramSocket ds;
         public boolean quit=false;
         public SubThread() {
              super();
              try {
                   ds = new DatagramSocket();
              } catch (Exception E) {
                   System.out.println("new DS failed: "+E.getMessage());
                   System.exit(-1);
         public void run() {
              byte[] buf = new byte[1000];
              DatagramPacket p = new DatagramPacket(buf, buf.length);
              System.out.println("Started subThread !");
              while (!quit) {
                   try {
                        ds.setSoTimeout(10000); // 10 Seconds
                        ds.receive(p);
                   } catch (SocketTimeoutException E) {
                        System.out.println("ST: Hit timeout !");
                   } catch (InterruptedIOException E) {
                        System.out.println("ST: Interrupted IO Works !: "+E.getMessage());
                        quit=true;
                   } catch (Exception E) {
                        System.out.println("ST: Exception: "+E.getMessage());
              System.out.println("Ended subThread !");
    }Test.java:
    package test;
    public class Test {
         static Integer a = 1;
         public static void main(String[] args) {
              SubThread st = new SubThread();
              st.start();
              try {
                   synchronized (a) {
                        System.out.println("Starting wait (1s) !");
                        a.wait(1000);
                        System.out.println("Sending interrupt()");
                        st.interrupt();
                        a.wait(1000);
                        if (!st.quit) {
                             System.out.println("As interrupts do not work, terminating by timeout !");
                             st.quit=true;
                             System.out.println("Waiting for end!");
                        } else
                             System.out.println("Ending !");
              } catch (Exception E) {
                   System.out.println("Exception: "+E.getMessage());
    }

    What is the intended behavior ?The intended behaviour is defined in http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Thread.html#interrupt()
    ' If this thread is blocked in an I/O operation upon an interruptible channel then the channel will be closed, the thread's interrupt status will be set, and the thread will receive a ClosedByInterruptException.'
    DatagramSocket not being an InterruptibleChannel, this piece doesn't apply. None of the other pieces apply either, so the fallback applies:
    ' If none of the previous conditions hold then this thread's interrupt status will be set.'
    If you're getting an interrupted read() on one platform, that's a bonus, but it's not the defined behaviour.
    Use a DatagramSocket derived from DatagramChannel.open().socket() and it should work on all platforms.

  • Jview and ServerSocket...

    I have run into an interesting scenario.... and I was mainly wondering two things...
    1- Has anyone else experienced this?
    2- Has anyone else found a solution?
    Here is what I have discovered.
    Running a ServerSocket in Jview produces a registered ServerSocket, but then you cannot actually connect to it from the outside.... it is some type of "Unknown host" or "No route to host" exception on the client end?
    Is this related to M$'s "embrace and extend" lawsuit settlement?
    Is there a work-around? (-->Yeah, I know.. use the Java Runtime Environment provided by Sun)
    ~Dave'

    OK... here's the deal...
    It works when both ends are running (The Server and the Client) in Sun's JRE. I have not checked it with both sides running in the MVM (jview)...
    What has failed is this...
    Jview running the ServerSocket
    Java running the Client that connects to it.
    It definitely fails this way, and I am not quite sure why...
    My 'client' end running in the JRE attempts to create a socket to his Server end *running in Jview on Win98.  It fails and resorts to a fallback method to get a connection....  But the output logs tell me certainly that the connection the way it was intended did not work with this VM combination, despite the fact that it works with the other..
    (It took us a while to figure out what had happened to make it stop working, and the he told me he had ran the "RunTest_with_Jview.bat" file instead of the "RunTest_with_JRE.bat"...)
    I could provide the failing code --> except for the fact that the entire application consists of approx 80 Java files... ;-)
    I could provide a minimalist test suite and e-mail it to you?
    Thanks for the try at helping me..
    ((Is there a Jview update for the Win98 second edition or something that we are missing??))
    ~Dave
    [email protected]

  • Runtime.exec and ServerSocket for IPC...blocking problems

    I have built an IDE for assembling/deploying web applications.
    I am supporting a 'test' mode in the IDE where a compiled 'solution/application' is executed in a separate vm from the IDE using Runtime.exec. For the whole sandbox thing. Don't want a wayward application crashing my IDE.
    Naturally I want a way to communicate start/stop from the IDE to the running application. So sockets are my only choice. Calling process.destroy from my IDE won't invoke a shutdownhandler in the generated application's vm, and I want an orderly shutdown as the generated applications open resources/etc.
    When I execute the generated application from within the IDE the thread code that creates a server socket blocks in the ServerSocket constructor...why?
    When I execute the solution using 'java' outside of my IDE, I can set up a server socket and all works fine.
    My IDE is NEVER creating server sockets waiting for client connects...only the generated application does this. So it isn't a case of the IDE already listening for requests on the same port as the server/generated application.
    Proving the above is that I can manually start my generated application, start my ide, then invoke the menuitem from the IDE that writes a 'close' byte to the client's socket...and the running application DOES shut down.
    Any ideas?

    I have decided on a different approach.
    At first I thought...ok I have the ServerSocket on the wrong 'side'. I then put the ServerSocket code in the always-running IDE and the Socket code on the running/exec'd application. But still a hang on the running application when constructing the Socket.
    I decided instead to call Process.destroy on the running app.
    Given that generated app is running in a separate vm, when it shuts down via process.destroy from the ide...although vm shutdown hooks aren't called...I guess it's ok since a destroy of the vm will release all resources. Not as clean as I'd like though.
    Additionally, I cannot determine 'true' start of application as no socket notification can be done. I merely determine start after a Runtime.exec of jvm process. Subsequent errors in startup will merely be determined by the IDE in process.waitFor or process.exitValue.
    I was getting a wierd socket error when attempting my prior solutions...and not a lot on the web regarding this subject...all relevant posts seemed to be in German/from Germany. Odd. Would need my wife to translate! Mein gott!
    I guess I could've communicated from ide to Runtime.exec'd application via a generated file in filesystem...but this seemed cheesy. Sockets should've been used for ipc between java vms...or so I thought.

  • DatagramSocket read and write methods

    Hi,
    I am trying to implement a client/server schame via NIO DatagramChannel.
    I manage to make it work with the methods send/receive. but i am not able to make it work in "connected" mode via write/read method.
    i bind and connect like this;
    this.channel = DatagramChannel.open();
    this.channel.configureBlocking(false);
    this.channel.socket().bind(hostAdr);
    this.channel.connect(destAddress);
    then i receive messages like this:
    ByteBuffer theReceiveDataByteBuffer = ByteBuffer.allocateDirect(5000);
    Charset charset = Charset.forName("ISO-8859-1");
    StringBuffer buffer = new StringBuffer();
    String[] retval = new String[2];
    while (flag) {
    try {
    Int value = receiverChannel.read(theReceiveDataByteBuffer);
    long time = System.currentTimeMillis();
    } catch (IOException e) {
    Thread.currentThread().interrupt();
    flag = false;
    I send via the write method, it seems i manage to send but i receive nothing...
    How to code this kind of scheme with write/read ?
    thank you
    Sebastien
    Edited by: sepi_seb on Nov 29, 2007 10:06 AM

    Well (a) you're spinning madly burning up the CPU in a non-blocking read loop; (b) if this is the complete code you don't have any way of knowing whether you received anything or not; and (c) you're completely suppressing any IOExceptions that may be occurring, so you can't see anything that's going wrong.
    So:
    (a) don't use non-blocking mode, or use a Selector to tell you when OP_READ is ready for the channel;
    (b) try breaking out of the loop when you've received something, i.e. when the bytecount returned from read() > 0; and then display something;
    (c) when you get an exception it contains a valuable message and an equally valuable stack trace. Don't just ignore them.

  • Timeout for  "new BufferedReader (new InputStreamReader (System.in));"

    BufferedReader in = new BufferedReader (new InputStreamReader (System.in));
    String message = in.readLine();  The above code waits infinitely until the user enter the data from the command line and presses enter key.
    The following code can provide a timeout to the above waiting (it works fine).
    But is there a SIMPLER WAY to provide timeout for above waiting, something like setSoTimeout(int milliseconds) method in DatagramSocket, Socket and ServerSocket classes*?*
    http://www.coderanch.com/t/232213/threads/java/implement-timeout-threads
    =>
    import java.util.Timer;  
    import java.util.TimerTask;  
    import java.io.*; 
    public class test{  
    private String str = "";  
         TimerTask task = new TimerTask(){  
                 public void run(){  
              if( str.equals("") ){  
                   System.out.println( "you input nothing. exit..." );  
                   System.exit( 0 );  
         public void getInput() throws Exception{  
              Timer timer = new Timer();  
              timer.schedule( task, 10*1000 );  
              System.out.println( "Input a string within 10 seconds: " );  
              BufferedReader in = new BufferedReader(  
                   new InputStreamReader( System.in ) );  
              str = in.readLine();  
              timer.cancel();  
              System.out.println( "you have entered: "+ str );   
         public static void main( String[] args ){  
              try{  
                   (new test()).getInput();
              }catch( Exception e ){  
                   System.out.println( e );  
              System.out.println( "main exit..." );  
    }

    No. System.in doesn't have a timeout API. Sockets do.

  • 7/24/2013 - AIR 3.8 Runtime and SDK

    Today we are excited to announce the availability of the released version of AIR 3.8 and encourage you to download, use, and provide us feedback.
    This update includes the following new features and changes:
    4096x4096 texture support – With this feature, a new profile, BASELINE_EXTENDED is introduced in the class flash.display3D.Context3DProfile, which will support a maximum texture size of 4096X4096.
    Rectangle Texture Support – Rectangle Textures are now supported in BASELINE as well as BASELINE_EXTENDED profile. The texture formats supported for Rectangle Textures are BGRA, BGR_PACKED and BGRA_PACKED. Details for usage can be found in the language reference.
    LZMA Support – On iOS and Android, LZMA compressed swfs can now be packaged and are supported.
    ServerSocket – ServerSocket APIs are now supported on iOS and Android.
    DatagramSocket – DatagramSockets APIs are now supported on iOS and Android.
    Notable bug fixes:
    Touch events extremely slow on AIR with Stage3D(3536911)
    [Android only-> GPU] Stage is blank in GPU mode because of rotationY property(3554585)
    [Android] [Screen Orientation] 'orientationChange' event is not fired when Stage rotated through setOrientation() method(3572885)
    [iPhone only] Application crashes when the Microphone is on for 10 to 20 mins(3560721)
    [Screen Orientation][Android] Application rotates even if tag is set to 'false' and tag is set to 'any'(3562132)
    StageWebView.drawViewPortToBitmapData draws incorrect bitmap on retina devices(3558603)
    Support PIE enabled Apps on iOS - Apple now encourages developers to have the PIE enabled binaries - A warning is shared when app is uploaded on Apple App Store(3556281)
    For further information please see our release notes.
    Download Locations:
    AIR 3.8.0.870 runtime for Windows: 3.8 Runtime Download
    AIR 3.8.0.910 runtime for Macintosh: 3.8 Runtime Download
    AIR 3.8.0.870 SDK & Compiler for Windows: 3.8 SDK & Compiler Download
    AIR 3.8.0.910 SDK & Compiler for Macintosh: 3.8 SDK & Compiler Download
    Note: To provide all the all the necessary tools for our developers in one place and avoid having to download multiple components, we are packaging Adobe AIR 3.8 SDK and ActionScript Compiler 2.0 in a single SDK called “Adobe AIR 3.8 SDK & Compiler”.
    AIR SDK 3.8.0.870 (Compatible with Flex) for Windows: 3.8 SDK Windows Download
    AIR SDK 3.8.0.910 (Compatible with Flex) for Macintosh: 3.8 SDK Macintosh Download
    Previous versions of the AIR runtime and SDK can be found on the Archived AIR SDK and Runtimes page

  • JavaMail Server: Sockets and Mail

    L.S,
    I'm thinking about combining code based on the Java Mail API and the Java networking tutorial (server sockets). I'm thinking I should listen to ports 25 and 110 using SMTP and POP3 protocol classes respectively.
    The problem I'm running into right now is that I haven't found a way to translate incoming email messages (bytestreams) into Java Mail objects.
    Can anyone point me in the right direction and help me find out how to translate bytes received at ServerSocket objects (ServerSocket(25) and ServerSocket(110)) into Java mails?

    Thanks, those are indeed important documents. Currently, I'm able to listen at port 25 for any incoming network transmissions. Unfortunately, when I try sending an email to the machine, the program sending it reports an error about the domain not being found (I also see nothing in my server console).
    ServerSocket smtp = new ServerSocket(25);
    boolean listening = true;
    while (listening) {
        Socket s = smtp.accept();
        PrintWriter out = new PrintWriter(s.getOutputStream(),true);
        BufferedReader in = new BufferedReader(new InputStreamReader(s.getInputStream()));
        System.out.println(in.readLine());
        out.println("ok");
        listening = false;
    s.close();
    smtp.close();According to me, the above program should at least print something to the console when another machine in my network sends an email to this machine (all@myclient). Somehow, though, I'm not getting anything...

  • DatagramSocket on mobile AIR 3.8

    I've created a really basic project to test the DatagramSocket in AIR 3.8 & Flash Player 11.8, but the DatagramSocket.isSupported property is coming back as false...even though Adobe says it is supported on Android & iOS.
    Another new feature is ServerSocket, when I trace that out it comes back as true. Has anyone had trouble using this?
    Capabilities.version = IOS 11,8,800,49
    NativeApplication.nativeApplication.runtimeVersion = 3.8.0.440
    DatagramSocket.isSupported = false
    ServerSocket.isSupported = true

    Ok, so I just created a blank ActionScript Mobile project, targeted the AIR 3.8 SDK, made sure my descriptor XML has 3.8 namespace, added "-swf-version=21" into the compiler options, compiled a debug build and traced out a few values.
    Capabilities Version IOS 11,8,800,49
    Runtime Version 3.8.0.440
    DatagramSocket.isSupported false
    Here is the SWF dump
    Adobe SWF Dump Utility
    Version 2.0.0 build 353900
    Copyright 2003-2012 Adobe Systems Incorporated. All rights reserved.
    <?xml version="1.0" encoding="UTF-8"?>
    <!-- Parsing swf file:/Volumes/LaCie/Projects/Flash Builder/DatagramSocketTest/bin-debug/DatagramSocketTest.swf -->
    <swf xmlns="http://macromedia/2003/swfx" version="21" framerate="24.0" size="10000x7500" compressed="false" >
      <!-- framecount=1 length=1404 -->
      <FileAttributes useDirectBlit="false" useGPU="false" hasMetadata="true" actionScript3="true" suppressCrossDomainCaching="false" swfRelativeUrls="false" useNetwork="true"/>
      <Metadata>
            <![CDATA[<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'><rdf:Description rdf:about='' xmlns:dc='http://purl.org/dc/elements/1.1'><dc:format>application/x-shockwave-flash</dc:format><dc:title>Adobe ActionScript Application</dc:title><dc:description></dc:description><dc:publisher>unknown</dc:publishe r><dc:creator>unknown</dc:creator><dc:language>EN</dc:language><dc:date>May 18, 2013</dc:date></rdf:Description></rdf:RDF>
    ]]>
      </Metadata>
      <EnableDebugger2 password="NO-PASSWORD" reserved="0x1975"/>
      <!-- unknown tag=63 length=16 -->
      <ScriptLimits scriptRecursionLimit="1000" scriptTimeLimit="60"/>
      <SetBackgroundColor color="#FFFFFF"/>
      <ProductInfo product="FLEX" edition="NONE" version="4.6" build="23201" compileDate="5/18/13 2:34 PM"/>
      <FrameLabel label="DatagramSocketTest"/>
      <DoABC name="DatagramSocketTest"/>
      <SymbolClass>
        <Symbol idref="0" className="DatagramSocketTest" />
      </SymbolClass>
      <ShowFrame/>
    </swf>

  • Two servers (serverSocket) behind the SAME firewal !?l

    Hello !
    I dont know if this is the right forum for this qusetion,
    and maybe the question is really stupid, but ...
    I made a little client/server application, just to
    play around with sockets and serverSockets.
    It works fine, but now i ask myself:
    What happens, if there are two of my servers running on two
    different computers in the SAME LAN behind the SAME
    firewall/internetgateway, and both are listening on the SAME
    port ?
    F.e. if the extern IP of this LAN/(its gateway) is
    204.556.234.123, and a client in the internet is connecting
    to it on the port, on which the two servers behind the firewall
    are listening, WHO'S ANSWERING ?
    (If this port is set to "open and forward" in the firewall)
    The one with the shorter patch-cable ? ;)
    How is it possible for the client to differenciate
    this two servers in that LAN?
    The only logical solution i found is that this two servers
    have to listen on different ports,
    but i think there has to be another explanation and/or solution.
    Do i have to take care about situations like that in my
    server-application ?
    I have the feeling that i have to...somehow.
    OK, you see i dont know much about this...
    i would be very thankful for every hint and explanation.
    Thank you very much,
    greetings,
    huni.

    F.e. if the extern IP of this LAN/(its gateway) is
    204.556.234.123, and a client in the internet is
    connecting
    to it on the port, on which the two servers behind the
    firewall
    are listening, WHO'S ANSWERING ?
    (If this port is set to "open and forward" in the
    firewall)Whichever one the firewall is told to forward it to!
    The two computers running your server have unique addresses on the internal network. The firewall will forward incoming connections to one of those addresses. Maybe it can do some simple "load balancing" by forwarding some connections to one server and some to the other, but still, any particular connection will only go to one server.

  • How to handle multiple clients with DatagramSocket

    I am trying to handle multiple clients with 1 datagramSocket bind to one port (basically I have only one port to use, and I can not use TCP or any other ports). At the server side I have two threads one for receiving packets and buffering them, another for processing the packets in the buffer and sending replies.
    I can have multiple clients sending datagramPackets to me and I will have to process the packets and send them to DIFFERENT clients. Ex. Client 1 sends datagramPacket to Server which sends the processed packet to Client 2. Also Client 2 sends a datagramPacket to Server which again processes the packet and sends it to Client1. May have Client 3 and 4 doing the same thing at the same time... and so on...
    My root class is creating the datagramSocket(somePort) and two threads (receiver and sender). How can I use the socket that I created in these two threads??
    I have done the following and I am getting "java.net.bindexception". When I am sending stuff from Client1 to Client2 everything is fine but when I start sending something from Client2 to Client 1, I get the bindexception... Client 1 is using port 3000, Client 2 is using port 4000.
    I really don't have a lot of experience in socket programming so I am not sure if there is a much simpler way to do this. I appreciate all the tips and help that I can get...
    Thanks...
    class UDP_serv
         static DatagramSocket udpSocket;
         final static int SERVER_PORT     = 2000;
         public static void main(String[] args) throws SocketException
              udpSocket= new DatagramSocket(SERVER_PORT);
              new DataReceiver().start ();
              new DataSender().start ();
         static class DataReceiver extends Thread
              DataReceiver()
                   Thread.currentThread().setName("DataReceiver");
              public void run()
                   while (true)
                        byte pckt[] = new byte [MaxMsgSize];          
                        DatagramPacket dp = new DatagramPacket (pckt, pckt.length);
                        try
                             udpSocket.receive (dp);
                             //PUSH TO RECEIVE BUFFER
                        catch(Exception e)
                             e.printStackTrace();
         static class DataSender extends Thread
              DataSender()
                   Thread.currentThread().setName("DataSender");
              public void run()
                   while (true)
                        processDataMsg();
          static void processDataMsg() 
             DatagramPacket op;
             InetAddress DA = null;
             int DP = 0;
             byte [] outPacket = null;
             // POP FROM RECEIVE BUFFER
             // SOME PROCESSING HERE     
             // Set Destination Address (DA)
             // Set Destination Port (DP)
             // DA and DP are the forwarding IP and Port addresses
             // not the addresses original packet was sent from.
             try
              op = new DatagramPacket (outPacket, outPacket.length,DA, DP);
              udpSocket.send(op);
             catch (IOException e)
              e.printStackTrace();
    }Also for development and testing purposes, I am running the two clients and the server on the same machine (windows xp-32b) so all of the Destination IP Addresses are 127.0.0.1. and as I said Ports that I am using are 2000, 3000, 4000 (Server, Client1, Client2).

    Hmm I have minimized the code and it seems to be working now.
    I think I have an error in the header portion of the data I am sending, where I am storing the source IP/Port and destination IP/Port. I think the server in the middle is messing these values up while sending them to the destination Client. Because the destination client actually receives the stuff and sends the reply back to the server, but the reply packet's headers has 0/0 as the dest IP / Port...
    Server is giving me java.net.BindException: Cannot assign requested address error when it tries to forward the reply it received from the client2 as the address it is trying to send is 0!
    I guess it doesnt just give this error when you try to open two sockets to the same port...
    Paul, Thanks for the direction on how to proceed... took me a while get the minimized code but at least figured out the problem. Well still have to make sure that is THE problem though :)
    As far as the statics goes how can I change those to non static ones? Where do I make an instance of the top level class that creates the threads? and how do I pass the DatagramSocket to the threads/ if I dont need to pass how do I call or use the datagramSocket I created in the top level class? I mean do I still kinda have it like a global variable on the top?? A very simple example would be much appreciated...
    I think these might be really basic questions but I am having a rough time with the hierarchy in java...

  • Implement SSL in JSP and servlets

    hi there,
    i needed some help in implementing ssl in JSPs and servlets. My idea was to have a login page and also use it where sensitive data is being sent. I have used the basic socket programming (socket.class and serverSocket.class) in GUI applications using threads to listen and send simultaniously and understand how it works but how do I implement it in JSP and servlets and where do i store the certificate?
    i do know that using SSL sockets is very much the same as using the normal sockets.
    can anyone tell me any useful links or give me a step by step guide how to implement it and which classes to use
    your help would be very much appreciated.
    mani

    hi,
    soory for late reply.
    i think you need to use keytool program in your JDK to generate a certificate signature file and you need to configure the server.xml to open and use the HTTPS port. I have not had any additional info on this but i would assume that you simply enter https:// on the file you wish to load in your form and it should use the HTTPS port provided it can find the certificate which must be stored somewhere in your tomcat web server. i would recommend you see tomcat website or search on google for "ssl support in tomcat".i hav not had time to look into this but i will as soon as i am free from my work load.
    mani

  • Cannot Stop Thread with ServerSocket

    Hi
    I have a problem with a Thread that runs a ServerSocket. I want to stop this Thread from the main-application:
    Thread class:
    Constructor:
    serverSocket = new ServerSocket(address, port);
    public void run() {...
    while (true) { ....
    clientSocket = serverSocket.accept();
    I want to do the following in the main-application:
    because I want to set up a Thread with a new ServerSocket:
    myThread = null; // to stop the Thread, I also have tried to interrupt without success
    myThread = new Thread(); // => BindException and serverSocket == null;
    I always catch a BindException and in the Thread-Constructor the serverSocket is set null !
    How can I avoid this?
    I need to get a new serverSocket!!
    Can anyone help me?
    thanks, walter

    Thank's for reply: The problem I have is the following: My domain has a dynamic IP, so after the IP changes the s.accept() does not work any more!
    try // Point 1 *)
    ServerSocket s = new ServerSocket(portNumber);
    for(;;)     
    Socket incoming = s.accept(); // does not work after IP changes
    new ThreadedEchoHandler(incoming, i).start();
    So I have to detect that the IP has changed and have to start again at Point 1
    How can I do this?
    thx walter

  • Sockets .. IO controlling TCP frame length and number of packets

    Here's the deal, I'm trying to develop a proxy for this application, an application wich is registred and can only be used from a specific host. I want to do it from another location, so I am writing a proxy.
    This should be trivial. But it has proven not to be!
    1. I am using java.net.Socet and ServerSocket
    2. I am using DataInput/OutputStream writeByte/readByte
    3. flushing after each byte OR not, same result
    It is not working, I GET the data just fine, and transmit it just fine, but the server doesnt respond.
    With a network sniffer, the only difference I can see is that with the original application (C++) only ONE TCP packet is transmitted over the network length = 52
    With my proxy TWO TCP packets is transmitted first LEN=1 and second LEN=51 for a grand total of the exact data ..
    So all other things being equal, im thinking that this must be my issue!
    Anyway I can deal with this ?
    Any ideas welcome!
    ps. tried .setBuffer .noTcpDelay etc. and gotten the same results .... perhaps nio gives more options ?
    Thanks.

    Your network "sniffer" operates at a lower level than you application. The differences in Ethernet frame that you are detecting with the network sniffer should not change the behavior of your TCP/IP application because, at the sockets programming level, the TCP stream has no boundaries.
    I have noticed the behavior in Java that you mention. I think I have seen it in the implementation of java.io.DataOutputStream.writeBytes(String), where they write the bytes one-byte-at-a-time and your get this side-effect. The source for that method looks like:
        public final void writeBytes(String s) throws IOException {
            int len = s.length();
            for (int i = 0 ; i < len ; i++) {
                out.write((byte)s.charAt(i));
            incCount(len);
        }What happens is that in that first call to out.write(), the something decides to send the one byte right away, and only on the second and third bytes does something (not sure if it is Java or TCP/IP) see that it is piling up and attempt to bunch up the bytes into a single frame.
    If you, the the Java programmer, wanted to avoid this, you would have to avoid all use of writeBytes(String s) and convert your String's to byte arrays explicitly, and then only call write(byte[] b, int off, int len), but all this should change it what you see in your network sniffer, not how the application behaves.

  • Maximum number of DatagramSockets

    I'm sending a DatagramPacket to 4000 different hosts, and I have successfully multi-threaded (50 threads) the process by having 50 DatagramSockets sending and recieving 50 DatagramPackets every 2 seconds.
    I'd like to up the number to 200 threads (meaning 200 sockets sending/receiving 200 packets every 2 seconds), do you guys think this is an issue? is there a limitation on the number of sockets I have active at a current time?
    Coles Notes: What is the maximum number of DatagramSockets can I run concurrently?
    thanks!
    -M

    how can I use 1 DatagramSocket for N hosts given that I'm multi-threading the operation?You can have multiple threads writing to the same socket. You can have a single thread reading from it and despatching messages to the session threads depending on where the incoming datagram came from.
    doesn't the the connect() method in the DatgramSocket class connect to only 1 host?Of course, but you don't have to call it at all. It doesn't do much.

Maybe you are looking for

  • Cisco Jabber for iPad - custom URL?

    The Cisco Jabber client for iOS is great, and we'd love to integrate it with one of our iPad applications. All iOS applications have an optional "custom URL" they can assign to themselves that enables them to be invoked by another application. They m

  • ITunes 11 Not Responding When I Try to Burn a CD

    So.. I have a Windows PC, Windows 7 64Bit. I installed the latest version of iTunes. When I insert a CD-R to burn, it immediately goes into "NOT RESPONDING" mode. Now, I don't even get that pop-up that allows me to choose CD, Data Disc or MP3 disc. T

  • Help with Podcast display in iTs

    Hello all, I have recorded a podcast in Garageband and published it to iWeb which is hosted in an extension from my Wordpress blog (AngryWeb.net/podcast). After the podcast was approved, I noticed that the artwork wasn't showing up in iTs, I put the

  • Java.lang.NullPointerException in 11.1.1.6.0

    I am getting errors all over in 11.1.1.6.0 this is the second time I installed. I am creating new projects. Not migrating. Anyone getting these. Performing action New...[ from oracle.ide.navigator.ProjectNavigatorWindow ] oracle.ide.ExtensionRegistry

  • Iphone 5s I had two apple IDs from the original switch to mobile me

    When I purchased my iphone 5s I had two apple IDs which were supposed to be recognized as one because I switched it to a me.com from mac.com but used the same prefix. I was told that my [email protected] was going to be the same as my [email protecte