Sockets: How can server detect that client is no longer connected?

Hi,
I really need help and advice with the following problem:
I have a Client - Server socket program.
The server listens on port 30000 using a server socket on one machine
The client connects to localhost on port 20000, previously creating an ssh port forward connection using the Jsch package from www.jcraft.com with
"session.setPortForwardingL(20000, addr, 30000);"
Then the client sends Strings to the server using a PrintWriter.
Both are connected to each other through the internet and the server uses a dynamic dns service.
This all works well until the IP address of the Server changes, The client successfully reconnects to the server using the dynamic dns domain name, but the server keeps listening on the old socket from the previous connection, while opening a new one for the new client connection. The server doesn't seem to notice that Client has disconnected because of this IP address change.
looks like the server is stuck inside the while loop. If i cut the connection manually on the client side, the server seems to notice that the client has disconnected, and jumps out of the while look (see code below)
this is the code I'm using for the server:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.Socket;
import java.util.logging.Logger ;
public class SocketHandler extends Thread {
    static Logger logger = Logger.getLogger("Server.SocketHandler");
    private Socket clientSocket = null;
    private BufferedReader in = null;
    private InputStreamReader inReader = null;
    public SocketHandler(Socket clientSocket) throws IOException {
        this.clientSocket = clientSocket;
        inReader = new InputStreamReader(clientSocket.getInputStream ());
        in = new BufferedReader(inReader);
    public void run() {
        try {
            String clientMessage = null;
            while ((clientMessage = in.readLine()) != null) {
                logger.info("client says: " + clientMessage);
        } catch (IOException e) {
            logger.severe(e.getMessage());
            e.printStackTrace();
        } finally {
            try {
                logger.info("closing client Socket: " + clientSocket);
                clientSocket.close();
                in.close();
                ServerRunner.list.remove(clientSocket);
                logger.info("currently "+ServerRunner.list.size()+" clients connected");
            } catch (IOException e) {
                logger.severe (e.getMessage());
                e.printStackTrace();
}I've tried making the server create some artificial traffing by writing some byte every few seconds into the clients OutputStream. However I get no exceptions when the IP address changes. The server doesn't detect a disconnected socket connection.
I'd really appreciate help and advice

If a TCP/IP peer is shut down "uncleanly", the other end of the connection doesn't get the final end of connection packet, and read() will wait forever. close() sends the final packet, as will killing the peer process (the OS does the close()). But if the OS crashes or for some other reason can't send the final packet, the server never gets notification that the peer has gone away.
Like you say, one way is timeout, if the protocol is such that there always is something coming in at regular intervals.
The other way is a heartbeat. Write something to the other end periodically, just some kind of "hello, I'm here, ignore this message". The other end doesn't even have to answer. If the peer has gone away, TCP will retransmit your heartbeat message a few times. After about a minute it will give up, and mark the socket as broken. read() will then throw an IOException. You could send heartbeats from the client too, so that the client detects if the server computer dies.
TCP/IP also has a TCP-level heartbeat; see Socket.setKeepAlive(). The heartbeat interval is about two hours, so it takes it a while to detect broken connections.

Similar Messages

  • How can I detect that there is an internet connection?

    How can I detect that there is an internet connection?
    Peter Goossens

    How can I detect that there is an internet connection?
    Peter Goossens
    Peter,
    You might want to experiment with this. It's not perfect, but...
    Class
    Imports System.IO
    Imports System.Net
    Namespace InternetConnection
    Public Class SiteInfo
    Private _displayName As String
    Private _connectionString As String
    Private Sub New(ByVal name As String, _
    ByVal connectionString As String)
    _displayName = name.Trim
    _connectionString = connectionString.Trim
    End Sub
    ''' <summary>
    ''' Gets the connection string of this instance.
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public ReadOnly Property ConnectionString() As String
    Get
    Return _connectionString
    End Get
    End Property
    ''' <summary>
    ''' Gets the display name of this instance.
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public ReadOnly Property DisplayName() As String
    Get
    Return _displayName
    End Get
    End Property
    ''' <summary>
    ''' A method which will add a new site to your collection of SiteInfo.
    ''' </summary>
    ''' <param name="siList">Your generic List(Of SiteInfo).</param>
    ''' <param name="displayName">The display name for this new instance
    ''' of SiteInfo.</param>
    ''' <param name="connectionString">The connection string for this
    ''' new instance of SiteInfo.</param>
    ''' <remarks></remarks>
    Public Shared Sub AddNew(ByRef siList As List(Of SiteInfo), _
    ByVal displayName As String, _
    ByVal connectionString As String)
    Try
    If siList Is Nothing Then
    Throw New NullReferenceException("The collection of SiteInfo cannot be null.")
    ElseIf String.IsNullOrEmpty(displayName) OrElse displayName.Trim = "" Then
    Throw New ArgumentException("The display name cannot be null or empty.")
    ElseIf String.IsNullOrEmpty(connectionString) OrElse connectionString.Trim = "" Then
    Throw New ArgumentException("The connection string cannot be null or empty.")
    Else
    If siList.Count > 0 Then
    Dim findDuplicate As IEnumerable(Of SiteInfo) = _
    From si As SiteInfo In siList _
    Where si.DisplayName.ToLower.Replace(" "c, "") = _
    displayName.ToLower.Replace(" "c, "") AndAlso _
    si.ConnectionString.ToLower.Replace(" "c, "") = _
    connectionString.ToLower.Replace(" "c, "")
    If findDuplicate.Count <> 0 Then
    Throw New ArgumentException("This is a duplicate entry.")
    Else
    siList.Add(New SiteInfo(displayName, connectionString))
    End If
    Else
    siList.Add(New SiteInfo(displayName, connectionString))
    End If
    End If
    Catch ex As Exception
    Throw
    End Try
    End Sub
    ''' <summary>
    ''' A method which will return a boolean value to indicate internet
    ''' connection status.
    ''' </summary>
    ''' <param name="siList">Your generic List(Of SiteInfo).</param>
    ''' <param name="displayName">The display name for the instance
    ''' of SiteInfo to use.</param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Shared Function InternetIsConnected(ByVal siList As List(Of SiteInfo), _
    ByVal displayName As String) As Boolean
    Dim retVal As Boolean = False
    Try
    If siList Is Nothing Then
    Throw New NullReferenceException("The collection of SiteInfo cannot be null.")
    ElseIf siList.Count = 0 Then
    Throw New ArgumentOutOfRangeException("Count", "The collection of SiteInfo cannot be empty.")
    ElseIf String.IsNullOrEmpty(displayName) OrElse displayName.Trim = "" Then
    Throw New ArgumentException("The display name cannot be null or empty.")
    Else
    Dim findInstance As IEnumerable(Of SiteInfo) = _
    From si As SiteInfo In siList _
    Where si.DisplayName.ToLower.Replace(" "c, "") = _
    displayName.ToLower.Replace(" "c, "")
    If findInstance.Count <> 1 Then
    Throw New ArgumentException("This instance is not in the collection of SiteInfo.")
    Else
    retVal = TestConnection(findInstance.First.ConnectionString)
    End If
    End If
    Catch ex As Exception
    Throw
    End Try
    Return retVal
    End Function
    Private Shared Function TestConnection(ByVal url As String) As Boolean
    Dim retVal As Boolean = False
    Try
    Dim request As WebRequest = WebRequest.Create(url)
    Using response As HttpWebResponse = DirectCast(request.GetResponse, HttpWebResponse)
    Using dataStream As Stream = response.GetResponseStream
    Using reader As New StreamReader(dataStream)
    Dim responseFromServer As String = reader.ReadToEnd()
    retVal = True
    End Using
    End Using
    End Using
    Catch ex As WebException
    retVal = True
    Catch ex As Exception
    retVal = False
    End Try
    Return retVal
    End Function
    End Class
    End Namespace
    Example Usage
    Public Class Form1
    Private Sub Form1_Load(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) _
    Handles MyBase.Load
    Dim siList As New List(Of InternetConnection.SiteInfo)
    InternetConnection.SiteInfo.AddNew(siList, _
    "Test1", _
    "http://dev.virtualearth.net/REST/v1/Locations/37221?o=xml")
    InternetConnection.SiteInfo.AddNew(siList, _
    "Test2", _
    "nothing here")
    InternetConnection.SiteInfo.AddNew(siList, "Test3", _
    "www.google.com")
    InternetConnection.SiteInfo.AddNew(siList, "Test4", _
    "http://fls-online.com")
    ' This will return true:
    Dim bool1 As Boolean = _
    InternetConnection.SiteInfo.InternetIsConnected(siList, _
    "Test1")
    ' This will return false:
    Dim bool2 As Boolean = _
    InternetConnection.SiteInfo.InternetIsConnected(siList, _
    "Test2")
    ' This will return false:
    Dim bool3 As Boolean = _
    InternetConnection.SiteInfo.InternetIsConnected(siList, _
    "Test3")
    ' This will return true:
    Dim bool4 As Boolean = _
    InternetConnection.SiteInfo.InternetIsConnected(siList, _
    "Test4")
    Stop
    End Sub
    End Class
    Let me know your results please?
    Still lost in code, just at a little higher level.

  • How can i detected that the channel is closed with nio async?

    using nio, I can wait accept, read data, write data asynchronously.
    now i make a server program, and want to dected if a socket is closed by client, how can i do this?
    thanks.

    TO: ejp
    In TCP the only way you can detect a dead connection is to attempt to write to it.
    Eventually this will fail probably with a SocketException 'connection reset'.When should this happen? I don't seem to get any expection. The socket is registered for read only but it never gets read for reading again. The appropriate selection key indicates it is writable, but I don't have it registered for write operation.
    Isn't there any other way to get around those dead sockets without trying to write at them? This would be quite an overhead, since server has to send some check_alive message periodically...

  • How can I detect that a device is from Motorola !

    hi all !
    I want to detect if my device is a Motorola one, to do so, I was checking the class com.motorola.extensions.ScalableImage, if it's present I know that the device is a Motorola.
    but, now, I have some devices (V8) that didn't support this class, so how can I do otherwise ?
    I saw that there's an API named get URL from flex, but i don't now more about !
    some one can help me ?
    Regards, Idir

    check this out
    // detecting NOKIA or SonyEricsson 
                      try { 
                               final String currentPlatform = System.getProperty("microedition.platform"); 
                               if (currentPlatform.indexOf("Nokia") != -1) { 
                                   return "nokia"; 
                               } else if (currentPlatform.indexOf("SonyEricsson") != -1) { 
                                   return "SE"; 
                      } catch (Throwable ex) { 
                   // detecting SAMSUNG 
                      try { 
                               Class.forName("com.samsung.util.Vibration"); 
                               return "samsung";
                      } catch (Throwable ex) { 
                   // detecting MOTOROLA 
                      try { 
                               Class.forName("com.motorola.multimedia.Vibrator"); 
                               return "motorola";
                      } catch (Throwable ex) { 
                               try { 
                                   Class.forName("com.motorola.graphics.j3d.Effect3D"); 
                                   return "motorola";
                               } catch (Throwable ex2) { 
                                   try { 
                                            Class.forName("com.motorola.multimedia.Lighting"); 
                                            return "motorola";
                                   } catch (Throwable ex3) { 
                                            try { 
                                                Class.forName("com.motorola.multimedia.FunLight"); 
                                                return "motorola";
                                            } catch (Throwable ex4) { 
                   // detecting SIEMENS
                      try { 
                               Class.forName("com.siemens.mp.io.File"); 
                               return "siemens"; 
                      } catch (Throwable ex) { 
                   // detecting LG 
                      try { 
                               Class.forName("mmpp.media.MediaPlayer"); 
                               return "LG";
                      } catch (Throwable ex) { 
                               try { 
                                   Class.forName("mmpp.phone.Phone"); 
                                   return "LG";
                               } catch (Throwable ex1) { 
                                   try { 
                                            Class.forName("mmpp.lang.MathFP"); 
                                            return "LG";
                                   } catch (Throwable ex2) { 
                                            try { 
                                                Class.forName("mmpp.media.BackLight"); 
                                                return "LG";
                                            } catch (Throwable ex3) { 
                      }  pravin

  • How can I detect workbooks which are not longer in use?

    Hello togehter,
    I am looking for a way to detect BEX Workbooks which are not longer in use. Is there something in the BC which I can use for that?
    Best would be some query with the information of when and by whom a workbook gets called up last time.
    Thanks!
    Andreas

    Hi Edward,
    there is no key figure providing this information.
    First of all you got convert the 0CALDAY from Date to Number, therefore you got to configure a new variable (by replacement path) and put it into a formula.
    Use the result of this formula as a column and create a new TOP 1 condition on it.
    Now you will only get one row per Workbook/Query (or whatever you have chosen) with the date of the last use of it.
    Regards,
    Andreas

  • How can I detect that a step was forced to fail or forced to pass?

    When I set one step to ForceFail, and another step to ForcePass, and I run the test sequence, the ResultStatus is just "Failed" or "Passed" without providing any feedback that it was not a true test.  Is there a way to detect / document this?
    Solved!
    Go to Solution.

    I'll do you one better, here's a working example. It uses the SequenceFilePostResultListEntry callback, but you could also implement it in process model using ProcessModelPostResultListEntry. You may have to modify your stylesheet to get results to populate correctly, particularly with XML or ATML reporting.
    It's pretty simple: if the reporting step uses either Force Pass or Force Fail, the callback updates both the UI's ResultStatus and the Result.Status going into the report. If you only want one or the other, remove or comment out the part you don't want.
    Attachments:
    ForcedPostStepExample.seq ‏6 KB

  • Async tcp client and server. How can I determine that the client or the server is no longer available?

    Hello. I would like to write async tcp client and server. I wrote this code but a have a problem, when I call the disconnect method on client or stop method on server. I can't identify that the client or the server is no longer connected.
    I thought I will get an exception if the client or the server is not available but this is not happening.
    private async void Process()
    try
    while (true)
    var data = await this.Receive();
    this.NewMessage.SafeInvoke(Encoding.ASCII.GetString(data));
    catch (Exception exception)
    How can I determine that the client or the server is no longer available?
    Server
    public class Server
    private readonly Dictionary<IPEndPoint, TcpClient> clients = new Dictionary<IPEndPoint, TcpClient>();
    private readonly List<CancellationTokenSource> cancellationTokens = new List<CancellationTokenSource>();
    private TcpListener tcpListener;
    private bool isStarted;
    public event Action<string> NewMessage;
    public async Task Start(int port)
    this.tcpListener = TcpListener.Create(port);
    this.tcpListener.Start();
    this.isStarted = true;
    while (this.isStarted)
    var tcpClient = await this.tcpListener.AcceptTcpClientAsync();
    var cts = new CancellationTokenSource();
    this.cancellationTokens.Add(cts);
    await Task.Factory.StartNew(() => this.Process(cts.Token, tcpClient), cts.Token, TaskCreationOptions.LongRunning, TaskScheduler.Default);
    public void Stop()
    this.isStarted = false;
    foreach (var cancellationTokenSource in this.cancellationTokens)
    cancellationTokenSource.Cancel();
    foreach (var tcpClient in this.clients.Values)
    tcpClient.GetStream().Close();
    tcpClient.Close();
    this.clients.Clear();
    public async Task SendMessage(string message, IPEndPoint endPoint)
    try
    var tcpClient = this.clients[endPoint];
    await this.Send(tcpClient.GetStream(), Encoding.ASCII.GetBytes(message));
    catch (Exception exception)
    private async Task Process(CancellationToken cancellationToken, TcpClient tcpClient)
    try
    var stream = tcpClient.GetStream();
    this.clients.Add((IPEndPoint)tcpClient.Client.RemoteEndPoint, tcpClient);
    while (!cancellationToken.IsCancellationRequested)
    var data = await this.Receive(stream);
    this.NewMessage.SafeInvoke(Encoding.ASCII.GetString(data));
    catch (Exception exception)
    private async Task Send(NetworkStream stream, byte[] buf)
    await stream.WriteAsync(BitConverter.GetBytes(buf.Length), 0, 4);
    await stream.WriteAsync(buf, 0, buf.Length);
    private async Task<byte[]> Receive(NetworkStream stream)
    var lengthBytes = new byte[4];
    await stream.ReadAsync(lengthBytes, 0, 4);
    var length = BitConverter.ToInt32(lengthBytes, 0);
    var buf = new byte[length];
    await stream.ReadAsync(buf, 0, buf.Length);
    return buf;
    Client
    public class Client
    private TcpClient tcpClient;
    private NetworkStream stream;
    public event Action<string> NewMessage;
    public async void Connect(string host, int port)
    try
    this.tcpClient = new TcpClient();
    await this.tcpClient.ConnectAsync(host, port);
    this.stream = this.tcpClient.GetStream();
    this.Process();
    catch (Exception exception)
    public void Disconnect()
    try
    this.stream.Close();
    this.tcpClient.Close();
    catch (Exception exception)
    public async void SendMessage(string message)
    try
    await this.Send(Encoding.ASCII.GetBytes(message));
    catch (Exception exception)
    private async void Process()
    try
    while (true)
    var data = await this.Receive();
    this.NewMessage.SafeInvoke(Encoding.ASCII.GetString(data));
    catch (Exception exception)
    private async Task Send(byte[] buf)
    await this.stream.WriteAsync(BitConverter.GetBytes(buf.Length), 0, 4);
    await this.stream.WriteAsync(buf, 0, buf.Length);
    private async Task<byte[]> Receive()
    var lengthBytes = new byte[4];
    await this.stream.ReadAsync(lengthBytes, 0, 4);
    var length = BitConverter.ToInt32(lengthBytes, 0);
    var buf = new byte[length];
    await this.stream.ReadAsync(buf, 0, buf.Length);
    return buf;

    Hi,
    Have you debug these two applications? Does it go into the catch exception block when you close the client or the server?
    According to my test, it will throw an exception when the client or the server is closed, just log the exception message in the catch block and then you'll get it:
    private async void Process()
    try
    while (true)
    var data = await this.Receive();
    this.NewMessage.Invoke(Encoding.ASCII.GetString(data));
    catch (Exception exception)
    Console.WriteLine(exception.Message);
    Unable to read data from the transport connection: An existing   connection was forcibly closed by the remote host.
    By the way, I don't know what the SafeInvoke method is, it may be an extension method, right? I used Invoke instead to test it.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • I have two personal e-mail accounts and a general account that I have synced to my Mail app, but I keep getting emails sent to the non-personal e-mail because they're on the same server. How can I change that?

    I have two personal e-mail accounts and a general account that I have synced to my Mail app, but I keep getting emails sent to the non-personal e-mail because they're on the same server. How can I change that?

    The only ways I know of for email to get sent to an account are:
    1. It was addressed to that account. Someone used that email address to send you the email.
    2. It was forwarded to that account by the account to which it had been addressed. I am not aware of Mail having this feature but it is often a feature provided by your ISP that you can turn on by logging into your account via the Internet and setting it up.  I assume you have not done this, though.
    With several email addresses in the same Mail client, you have to be careful which one you are sending from. If you send from the wrong address, any replies will come back to that same address. I make this mistake all too often.

  • How can I detect in Business HTML that the app was called from portal?

    How can I detect in Business HTML that the app was called from portal?
    I need to distinguish whether the application was called from portal (URL iView) or by using an URL outside of portal.
    So what I'm looking for is a variable or function that can be used like this:
    `if (~within_portal==1)`
      do this if called from portal
    `else;`
      do that if not called from portal
    `end;`
    For example, can I check in the program that there is a SSO2 cookie from the portal?
    I'm using Integrated ITS in Basis 700.

    Here is the trick:
      if (sapwp_active=="1")
        in portal
      else
        without portal
      end;

  • How can i check that server still running?

    Hi everybody,
    How can i check that server still running before sending post?

    There are several ways of verifying if server is still running
    1) Through JCMon command line tool on server
    Call jcmon as <sid>adm using following command
    jcmon pf=/usr/sap/<sid>SYS/profile/<sid>_<instance>_<host>
    jcmon displays the server processes in status "Running" if all applications have started successfully. Otherwise it displays the appropriate status message
    2) Through SAP MMC which again shows the graphical status as Green
    3) On NWDS using J2EE view
    4) If telnet port is enabled on J2EE Engine, then you can remotely check the status of server using telnet command

  • Need help to import and syncronize HCM pagelets with Interaction Hub, how can I do that?

    Hi,
    I need help to import and synchronize HCM pagelets with Interaction Hub, how can I do that? The default page "Select Remote Content" of the WorkCenter "Unified Navigation WorkCenter" is not working as well, when I run the import/sync button I get the following error message:
    Integration Gateway: General Connection Failed (158,10836)
    This error is thrown when there is no valid response.
    Possible errors include:
    Bad gateway URL
    Sync Service Timeout set and Service actually timed out.
    Java exception thrown - Check Application Server for possible Java exception

    Do you have integration configured between the two systems?  It sounds like you don't from the error.  Here is a walk-through on setting up Unified Navigation although it assumes you have integration already working.  If you haven't done that, it's documented a hundred different places.
    http://remotepsadmins.com/2013/03/04/peoplesoft-unified-navigation-with-peoplesoft-applicatations-portal-interaction-hub/

  • I have two email accounts on my MacBook Pro and iPhone.  My iPhone continues to send messages from either account that I choose.  My MacBook says that one of my email account outgoing mail servers is Offline?  How can I get that working again?

    I have two email accounts on my MacBook Pro and iPhone that I have been using for a few years.  My phone works perfectly for both accounts.  Now one of my email accounts on the MacBook says the outgoing server is Offline?  How can I fix that so that both accounts send and receive email.  I have tried various things in settings but nothing seems to work. 

    Hi Rochdr,
    You can use the following article to help you address this issue with your mail account in OS X:
    OS X Mail: Troubleshooting sending and receiving email messages
    http://support.apple.com/kb/ts3276
    Thanks for using the Apple Support Communities. Have a good one!
    -Braden

  • How can I detect a dialog and respond?

    I'm having trouble doing something that's probably not that hard. I'm trying to "Print to PDF" a bunch of old AppleWorks documents. When you open a document created in AppleWorks v6 it opens right up, but when you open a document created in AppleWorks 5 you get a dialog box that says, "This document was created by a previous version of AppleWorks. A copy will be opened and "[v6.0]" will be added to the filename."
    Right now I open the file and then:
    tell application "AppleWorks 6"
            activate
            repeat while not (exists front document)
                    delay .2
            end repeat
    end tell
    When the dialog box pops up, there's no front document so the whole thing freezes until you hit OK. How can I detect this dialog box and dismiss it?
    Thanks
    PS
    When the box is open I ran this and got this result:
    /usr/bin/osascript -e 'tell application "System Events" to get properties of windows of application process "AppleWorks 6"'
    minimum value:missing value, orientation:missing value, position:436, 153, class:window, role description:dialog, accessibility description:missing value, focused:missing value, title:missing value, size:412, 123, value:missing value, help:missing value, enabled:missing value, maximum value:missing value, role:AXWindow, entire contents:, subrole:AXDialog, selected:missing value, name:missing value, description:dialog, minimum value:missing value, orientation:missing value, position:8, 76, class:window, role description:floating window, accessibility description:missing value, focused:missing value, title:Starting Points, size:631, 189, value:missing value, help:missing value, enabled:missing value, maximum value:missing value, role:AXWindow, entire contents:, subrole:AXFloatingWindow, selected:missing value, name:Starting Points, description:floating window, minimum value:missing value, orientation:missing value, position:4, 22, class:window, role description:floating window, accessibility description:missing value, focused:missing value, title:Button Bar, size:612, 51, value:missing value, help:missing value, enabled:missing value, maximum value:missing value, role:AXWindow, entire contents:, subrole:AXFloatingWindow, selected:missing value, name:Button Bar, description:floating window

    Hi,
    The simplest would be to set the application preferences in the script.
    Like this :
    -- *** set prefs ****
    tell application "AppleWorks 6"
          activate
          set oldPrefs to its preferences
          copy oldPrefs to tPrefs
          tell tPrefs
                set old version warning to false --doesn't show the old version warning alert  
                set converted file suffix to true -- append “[v6.0]” to documents converted from older formats
                set locked file warning to false
                set paint reduction warning to false
          end tell
          set preferences to tPrefs
    end tell
    -- *** end set prefs ****
    --**** your script, example ***
    set tfiles to choose file with multiple selections allowed
    tell application "AppleWorks 6"
          repeat with i in tfiles
                open i
                tell front document
                      -- do something
                end tell
          end repeat
    end tell
    --**** end  your script ***
    -- *** reset prefs ****
    tell application "AppleWorks 6" to set preferences to oldPrefs

  • How can i detect if my PC is not on Network..... Urgent Pls Help Soon !!!!!

    Hello Everyone,
    We all know whenever we try to connect to a PC which is not on network, we get UnKnownHostException etc..... by which we can detect that the corresponding PC is not an network(intranet/internet)
    But when i send a msg from my PC to my PC, it works fine even if the network is down. I hv provided my PC's IP address instead of using localhost or 127.0.0.1 which reduces the possibility that the msg will not be traversed thru the network.
    Any IDEA how this works.
    Is There any possible way by which i can detect that my PC is not on network or the PC to which i'm trying to connect is not on network .......
    Pls help me out, its really urgent as to be implemented in my Project
    Thanks In Advance
    Sahil Shaikh

    Hello Surtee
    I have developed a Messeging Service for the eCRM Apllication my company is developing and we r in the final stage of debugging.
    Now whenever a user sends a msg to a PC which is not on network, the messaging service automatically sends an Offline mssg to that PC. But know i want ot distinguish wheather the PC to which i'm sending the msg is not on network or am I not on network based on this i need to perform diff. actions, hence i wanted to know that how can i detect .......
    Pls see if u canhelp me out ......
    Thanks
    Sahil Shaikh

  • How can I know which clients are connected to my network through express and which are connected through extreme?

    I have an airport express extending, through wireless, a network provided by an airport extreme. How can I know which clients are connected to my network through express and which are connected through extreme?
    Here you can see both routers:
    I would expect to some clients connected to the express, other than the extreme. And that's all I see: only the airport extreme appears as client of the airport express.
    Below, one can see the summary of the config for both routers.
    Would somebody explain it?
    Thanks,
    Marcelo
    Message was edited by: Marcelão

    please disregard this answer.
    Message was edited by: Marcelão

Maybe you are looking for

  • Compare with my cost of goods sold account to my sales revenue account

    Hi, i want to compare with my cost of goods sold account to my sales revenue account. After PGI my COGS a/c will be debited INVENTORY a/c will be credited so after sales my SALES a/c credit & customer a/c debit . I want to see what is the difference

  • Custom order?

    How do I set a custom order for a playlist? It seems before i could rearrange them with my mouse by holding the left click button, but now I can't, is there a problem?

  • How to generate WS and WSDL for proper working DS under ALDSP 3.0?

    Hi, Ive got small problem with generating WebService and WSDL for proper working DataService in AL Data Service Studio. Whats the worse, I cant find any good documentation showing how to do it step by step in the new development enviroment. Currently

  • Showing a date as a month name

    Using an Access App in Office 2013: Since the format for date/time is so limited, I am guessing that to have field showing the date as a month name, I need to use a calculated field and have the calculation use field named [dateadded]. I tried Month(

  • How do you fix a 0x000007b for In Design?

    How do you fix a 0x000007b for In Design?