TCP/IP matters

Hi to all
I was just wondering if it is necessary to close TCP/IP connection after an error(e.g connection lost) had occured. Is it ok if I just reopen another connection to the same IP and port without closing the existing connection(that connection which the error had occurred)? Will this lead to any conflicts in my program?
Another matter is, is it possible to query the IP of an device connected to my computer?
Thank you.
Solved!
Go to Solution.

rdtttttttttttttt wrote:
Thanks for all your answers.
I meant finding unknown Ip address of some device connected to comp.
There is no standard way a TCP/IP device (server) would announce its availability on a network. So each device/server employs its own method. This could be an UDP broadcast inquery to which it will listen on a well known port and send back an UDP packet to the requester with information such as its IP address.
Or there is a well known service in the network which can receive service registrations and cancelations and stores all registered services internally. Then a client can inquiry at that registrar service for a specific service name and receives the according information to be able to connect to it.
There are probably 500 other ways to skin this cat and all have for sure been tried by some device manufacturers.
Rolf Kalbermatter 
Rolf Kalbermatter
CIT Engineering Netherlands
a division of Test & Measurement Solutions

Similar Messages

  • Tomcat Servlet - TCP Port Already in Use?

    My problem is that tomcat/servlet is not releasing its TCP port after my servlet closes the port. Next time a servlet tries to use the port it gets an error "Port already in use". Using netstat I can see the port is still in use. If I stop tomcat and restart it, the port is released. I have not had this sort of problem writing C programs that use sockets.
    My setup is Fedora Core 6 with JDK1.5_14 and Tomcat 5.5.26. I know it's not the latest, but sockets and streams have been around for a long time.
    Actual implementation uses a trivial javaserver page to instantiate a class to create/accept connection from a client (JApplet). After connection, it starts a thread to receive data. I am using ServerSocket(), InputStreamReader(), and OutputStreamWriter(). On ServerSocket I set ReuseAddress to true.
    I have try/catch on all my I/O and use tomcat context log for error and OK messages. Data transfer is perfect. Detect close by client works. In the context log I see close of streams and ServerSocket occur with no exceptions. Then, I manually close the jsp window. No indication of any problems. If I use different port 2nd time (e.g. 50001) it all works perfect. If I use my default (50000) again, servlet gets an error during bind, "Port already in use".
    2.5 years with Java. 5 years with Linux and C.
    Please advise or refer

    rwengr wrote:
    My problem is that tomcat/servlet is not releasing its TCP port after my servlet closes the port. Next time a servlet tries to use the port it gets an error "Port already in use". Using netstat I can see the port is still in use. If I stop tomcat and restart it, the port is released. I have not had this sort of problem writing C programs that use sockets.Nice.... Not sure that matters though.
    >
    My setup is Fedora Core 6 with JDK1.5_14 and Tomcat 5.5.26. I know it's not the latest, but sockets and streams have been around for a long time.
    Actual implementation uses a trivial javaserver page to instantiate a class to create/accept connection from a client (JApplet). Bleah! Don't use a JSP for that. Use a servlet at worst. At best use a Servlet to start some other socket manager class which you can/have tested outside the Servlet Container environment.
    After connection, it starts a thread to receive data. I am using ServerSocket(), InputStreamReader(), and OutputStreamWriter(). On ServerSocket I set ReuseAddress to true.
    I have try/catch on all my I/O and use tomcat context log for error and OK messages. Data transfer is perfect. Detect close by client works. In the context log I see close of streams and ServerSocket occur with no exceptions. Then, I manually close the jsp window. Closing the browser window has no affect on the server.
    No indication of any problems. If I use different port 2nd time (e.g. 50001) it all works perfect. If I use my default (50000) again, servlet gets an error during bind, "Port already in use".
    2.5 years with Java. 5 years with Linux and C.
    Please advise or referShow some code. If you just want some generic advice it would be to close the port, as soon as you don't need it anymore. But you know that. Without any further code I think that is about all that can be said.
    P.S. Make the code as small as possible, compilable, but still demonstrating the problem. Also see: [this tutorial as an example...|http://www.javaworld.com/javaworld/jw-12-1996/jw-12-sockets.html?page=1]

  • How can we close the TCP connection in Extend Clients (C#)

    I tried to use a C# client to connect to server side Coherence Nodes. The problem is that, Coherence creates two new TCP connections every time I create a new cache, and it never closes the connection. In the end, Coherence keeps opening hundreds connection for me, and I faced the Out Of Memory Exception.
    I used Coherence Extend for the connection, and use Thread.CurrentPrincipal. I did the same thing in Java, and it works. I don't know why it doesn't work for C#.
    For now, is there any way provided by Coherence to close the open TCP connection?

    The issue was the AZURE_STORAGE_CONNECTION_STRING was set improperly. I was originally using the value from the 'sig' querystring value, instead of the entire signature querystring.
    SET AZURE_STORAGE_CONNECTION_STRING=BlobEndpoint=https://viperprodstorage1.blob.core.windows.net/;SharedAccessSignature=<signature>
    Should have been...
    SET AZURE_STORAGE_CONNECTION_STRING=BlobEndpoint=https://viperprodstorage1.blob.core.windows.net/;SharedAccessSignature=sr=c&si=foobar-prod-policy&sig=<signature>
    After that was set, I was able to upload.
    I don't know if this mattered much, but I also changed the format of the call to...
    azure storage blob upload -f "file.gz" --container "foobar-prod" -b "file.gz" --verbose

  • Counting TCP/IP packets

    Hello,
    I want to implement an SNMP Agent using Java, and I would like to know how can I count the packets coming and outgoing (IP, UDP, TCP, etc). This is to instrument the RFC1213 MIB. I don?t have access to the TCP/IP stack code, so I can?t use socket or something to count the packets. Is there any classes/methods to allow me to do this?
    Thanks a lot
    Fabio Mansur

    I want to implement an SNMP Agent using Java, and I
    would like to know how can I count the packets coming
    and outgoing (IP, UDP, TCP, etc). This is to
    instrument the RFC1213 MIB. I don?t have access to the
    TCP/IP stack code, so I can?t use socket or something
    to count the packets. Is there any classes/methods to
    allow me to do this?
    Not in standard java. And you can't normally do that in a normal install of windows either - if that matters.
    http://netresearch.ics.uci.edu/kfujii/jpcap/doc/index.html

  • 922 TCP ports closed!

    Hi All,
    Nmap gave me some disturbing news last night; I have 922 TCP ports closed on my computer, including stuff like Trinoo, Elite and some other trojans that I would think are Windows threats only. Even though the ports are closed (I've got firewall enabled), I have no idea how and why they appeared on my computer. I have a wireless router, but don't know if that matters. Thanks 4 your help.

    Hi,
    as you said, the ports are closed, this does mean that they are inaccessible so you don't have to worry. Additionally, when you're sitting behind a wireless router, it's own firewall should protect you from outside access. Anyway, it would be helpful if you could provide the whole output of nmap and tell us if you've scanned the IP which belongs to your local network or the IP which was assigned to your wireless router by your ISP.
    Cheers,
    ulrik

  • Slow TCP transfer...

    Hi,
    I'm benchmarking a ssh copy (scp) of a big file from an Apple Xserver G5 to a linux server, and on a bonded gigabit ethernet LAN, I only get at most 20MiB/s, whatever the direction of the transfer.
    From the linux server to another linux box on the same LAN, I get about 35MiB/s, which is considered normal.
    Netperf also show abysmal performance between the mac and the linux server, while normal when between linuxes.
    I tried every tuning I could on the mac side (sendspace, recvspace...), but couldn't increase the transfer rate past 20MiB/s.
    Both hosts are connected on the same Gigabit Ethernet switch. Both hosts are using LACP 802.3ad bonding (for what matters, since in this scenario only one slave is used).
    Any idea of what could be wrong?

    A few questions, answers to which might help find the problem.
    Have you taken a packet trace of the netperf or scp transfer?
    What is the performance you get on netperf?
    Does netstat show any TCP retransmissions on the sending side?

  • I have adobe CS6 on my old hard drive and i wish to transfer it over to my new hard drive. I no longer have the disc which it came on. How do I do this? also i have only ever put a single copy on a laptop and it is alowed 2........if that matters.

    I have adobe CS6 on my old hard drive and i wish to transfer it over to my new hard drive. I no longer have the disc which it came on. How do I do this? also i have only ever put a single copy on a laptop and it is alowed 2........if that matters.

    deactivate (help>deactivate) on your old hd.
    then install using the installation file(s) and your serial number.
    Downloadable installation files available:
    Suites and Programs:  CC 2014 | CC | CS6 | CS5.5 | CS5 | CS4, CS4 Web Standard | CS3
    Acrobat:  XI, X | 9,8 | 9 standard
    Premiere Elements:  13 |12 | 11, 10 | 9, 8, 7
    Photoshop Elements:  13 |12 | 11, 10 | 9,8,7
    Lightroom:  5.7.1| 5 | 4 | 3 | 2.7(win),2.7(mac)
    Captivate:  8 | 7 | 6 | 5
    Contribute:  CS5 | CS4, CS3
    Download and installation help for Adobe links
    Download and installation help for Prodesigntools links are listed on most linked pages.  They are critical; especially steps 1, 2 and 3.  If you click a link that does not have those steps listed, open a second window using the Lightroom 3 link to see those 'Important Instructions'.
    window using the Lightroom 3 link to see those 'Important Instructions'.

  • Error 'Program not registered' while testing RFC - SRM to MDM / TCP/IP conn

    Hello All,
    While testing RFC connection in SRM, we are getting this error. This connection between SRM to MDM. Any inputs will be highly appreciated.
    Error Details LOCATION: SAP-Gateway on host <hostname> / sapgw<instance no>
    our server OS : windows 2008 server
    We are getting error while doing connection test in SRM.
    This is sm59 connection (TCP/IP ) connection.
    Connection Type: T / RFC destination Name: MDM_API_CATALOG
    Registered server program: hostname.MDS
    I checked smgw transaction ..Logged on clients...Program id is not showing. Any hint will be helpful.
    I Checked this MDM setup also.
    MDS setup
    In mdm server go to folder F:\usr\sap\DM1\MDS00\config
    Open MDM.ini file in notepad
    Add the below 2 entries.
    SAP RFC Gateways= GWHOST=XXXX.hostnamexxx.xxx GWSERV=sapgw00
    Trusted SAP Systems= XXD
    This will enable gateway connection between SRM and MDM and will enable trusted connection.
    For trusted connections to work, we created a service user called SRM_MDM_API with SAP_ALL in SRM  and also created the same user in MDM with Default role.
    Error message:
    Logon  Connection Error
    Error Details    Error when opening an RFC connection
    Error Details    ERROR: program XXXXXXXXPRD.MDS not registered
    Error Details    LOCATION: SAP-Gateway on host XXXXXXXXprd.xx.xxxxxxhostname.xxx / sapgw00
    Error Details    DETAIL: TP XXXXXXXXPRD.MDS not registered
    Error Details    COMPONENT: SAP-Gateway
    Error Details    COUNTER: 77326
    Error Details    MODULE: gwr3cpic.c
    Error Details    LINE: 1778
    Error Details    RETURN CODE: 679
    Error Details    SUBRC: 0
    Error Details    RELEASE: 700
    Error Details    TIME:
    Error Details    VERSION: 2
    Procedure Tried
    1)  This procedure is for Linux OS - Similarly we tried in Windows OS ( If any procedure is wrong also, Please correct us)
    To register the program login into the OS level as sudo su u2013 <sid>adm and execute the following command.
    rfcexec u2013g<program id> -a<gateway host name> -x<gateway service>
    rfcexec is the server program name, the <program id> can be obtained from SM59, it is case sensitive and should match with the entry in SM59. The <gateway host name> and <gateway service> can be obtained from the transaction SMGW. When this command is executed it goes to a hanging loop.
    The connection will fail once this command is terminated or the user executing this command logs off
    2)
    To avoid this, instead of using the above mentioned command an entry should be made in the file saprfc.ini
    To do this, execute the following command
    sudo su u2013 <sid>adm
    rfcexec u2013D<destination name>
    <destination name> is the RFC destination name in SM59
    In order to do above step 2,  we could not find saprfc.ini in windows 2008 server. Please let us know path where it will be usually?
    3) Already checked the notes sapnote_0000684841
    I know that it is generic error..This is happening to specific one of system only.
    Thanks
    Edited by: saptest2011 on May 20, 2011 5:36 PM

    Hello SM,
    Thanks for your quick reply.
    Thanks for sharing link for document ie Configure the MDM Administration_cockpit. It is helpful. I read that document.
    But still issue remain there.
    The same RFC connection works between SRM sandbox to MDM sandbox.
    Only issue with SRM Prod to MDM Prod (newly built system)
    difference between MDM Prod and MDM sandbox.
    MDM Prod runs: Windows server 2008 OS
    MDM Sandbox runs: Windows server 2003 OS
    Landscape: PI7.1, MDM 7.1 and SRM 5.5, SRM-MDM Catalog 3.0
    Even i did os01 tcode ping test using host name (specific IP address) from SRM prod to MDM prod, it is fine.
    Thanks a lot for your help.
    I checked these notes also
    Note 353597 - Registering a server program
    Note 44844 - No connection to registered RFC program
    Note: in smgw tcode in SRM system, the required program id is not showing in logged on clients
    Thanks
    Edited by: saptest2011 on May 23, 2011 5:00 PM
    Edited by: saptest2011 on May 23, 2011 5:39 PM

  • XModem via TCP for Java

    I am sure that many of you experienced developers have read requests in the past concerning implmentation of Ward Christenen's XModem protocol over a TCP socket. If not, well... you are about to...
    This is a major hack... but it is starting to come together... thanks to Fred Potter for his source code to start this project...
    Objective:
    Basically, I want to create a console application which accepts an incoming connection and starts the receive mode for a XModem file transfer. I am using CGTerm (for Commodore retrocomputing) but can test with HyperTerminal as well...
    The user who connects to the server selects SEND and the FILE to send for a XModem file transfer... and the transfer begins...
    The incoming blocks of 128 bytes are written to a file
    After the transfer is over the server disconnects the client terminal.
    Here is what I have so far:
    import java.net.*;
    import java.lang.*;
    import java.io.*;
    // X-Modem Server implementation via TCP/IP socket
    public class XServer {
    public static FileWriter fw;
    public static void main(String[] args) throws IOException {
    // define the file
    try {   
    fw = new FileWriter("filename.txt");
    } catch (Exception e) {
    System.out.println(e);
    System.exit(0);
    int port = Integer.parseInt(args[0]);
    ServerSocket server = new ServerSocket(port);
    System.out.println("X-Server v1.0 - waiting for connection");
    Socket client = server.accept();
    // Handle a connection and exit.
    try {
    InputStream inputStream = client.getInputStream();
    OutputStream outputStream = client.getOutputStream();
    new PrintStream(outputStream).println("Go to send file mode!"); // sent to client
    System.out.println("Ready to receive file via X-Modem...");
    * BEGIN TRANSFER HERE!
    // set the debug flag
    XModem.debug = true;
    * Here we are instantiating a new InputStream that represents the remote
    * file that we are receiving. In this single line we are attempting to
    * start the flow.
    * Behind The Scenes: We're sending a NAK across the serial line repeatedly
    * until we finaly start seeing the data flow. If we don't see the data
    * flow, then we throw an exception.
    System.out.println("Sending NAK to start receive mode...");
    InputStream incomingFile;
    try {
    incomingFile = new XModemRXStream(inputStream, outputStream);
    } catch (IOException e) {
    System.out.println("ERROR! Unable to start file transfer!");
    e.printStackTrace();
    return;
    System.out.println("Starting file transfer...");
    * Here we are reading from the incoming file, byte by byte, and printing out.
    * Behind The Scenes: Internally, the read() method is handling the task of
    * asking for the next data block from the remote computer, processing it (i.e.
    * parsing, running checksums), and then putting it in an internal buffer. Not
    * all calls to read() will request a new data block as each block contains at
    * least 128 bytes of data. Sometimes you will only hit the buffer.
    try {
    for (;;) {
    int c = incomingFile.read();
    if (c==-1)
    break; // End of File
    // print character / byte
    System.out.print(c+",");
    // write to file
    try {       
    //System.out.print(".");
    fw.write(c);
    } catch (Exception e) {
    System.out.println(e);
    System.exit(0);
    } catch (IOException e) {
    System.out.println("error while reading the incoming file.");
    e.printStackTrace();
    return;
    // done
    System.out.println("File sent.");
    new PrintStream(outputStream).println("");
    new PrintStream(outputStream).println("transfer successful!");
    } finally {
    //client.close();
    // save the file
    try {   
    fw.close();
    System.out.println("file saved.");
    } catch (Exception e) {
    System.out.println(e);
    System.exit(0);
    * XModem keeps track of settings that the Receive and Transmit Stream classes will
    * reference.
    * <p>Copyright: Copyright (c) 2004</p>
    * @author Fred Potter
    * @version 0.1
    class XModem {
    public static boolean debug = false;
    * XModemRXStream is an easy to use class for receiving files via the XModem protocol.
    * @author Fred Potter
    * @version 0.1
    class XModemRXStream
    extends InputStream {
    // CONSTANTS
    private static final int SOH = 0x01;
    private static final int EOT = 0x04;
    private static final int ACK = 0x06;
    private static final int NAK = 0x15;
    private static final int CAN = 0x18;
    private static final int CR = 0x0d;
    private static final int LF = 0x0a;
    private static final int EOF = 0x1a;
    // block size - DON'T CHANGE - I toyed with the idea of adding 1K support but the code is NOT there yet.
    private static final int bs = 128;
    // PRIVATE STUFF
    private int ebn; // expected incoming block #
    private byte[] data; // our data buffer
    private int dataPos; // our position with the data buffer
    private InputStream in;
    private OutputStream out;
    * Creates a new InputStream allowing you to read the incoming file. All of the XModem
    * protocol functions are handled transparently.
    * As soon as this class is instantiated, it will attempt to iniatate the transfer
    * with the remote computer - if unsuccessful, an IOException will be thrown. If it
    * is successful, reading may commense.
    * NOTE: It is important not to wait too long in between calls to read() - the remote
    * computer will resend a data block if too much time has passed or even just give up
    * on the transfer altogether.
    * @param in InputStream from Serial Line
    * @param out OutputStream from Serial Line
    public XModemRXStream(InputStream in, OutputStream out) throws
    IOException {
    this.in = in;
    this.out = out;
    // Initiate the receive sequence - basically, we send a NAK until the data
    // starts flowing.
    init:for (int t = 0; t < 10; t++) {
    if (XModem.debug) {
    System.out.println("Waiting for response [ try #" + t + " ]");
    long mark = System.currentTimeMillis();
    out.write(NAK);
    // Frequently check to see if the data is flowing, give up after a couple seconds.
    for (; ; ) {
    if (in.available() > 0) {
    break init;
    try {
    Thread.sleep(10);
    catch (Exception e) {}
    if (System.currentTimeMillis() - mark > 2000) {
    break;
    // We have either successfully negotiated the transfer, OR, it was
    // a failure and timed out. Check in.available() to see if we have incoming
    // bytes and that will be our sign.
    if (in.available() == 0) {
    throw new IOException();
    // Initialize some stuff
    ebn = 1; // the first block we see should be #1
    data = new byte[bs];
    dataPos = bs;
    * Reads the next block of data from the remote computer. Most of the real XModem protocol
    * is encapsulated within this method.
    * @throws IOException
    private synchronized void getNextBlock() throws IOException {
    if (XModem.debug) {
    //System.out.println("Getting block #" + ebn);
    // Read block into buffer. There is a 1 sec timeout for each character,
    // otherwise we NAK and start over.
    byte[] buffer;
    recv:for (; ; ) {
    buffer = new byte[bs + 4];
    for (int t = 0; t < 10; t++) {
    System.out.println("\nReceiving block [ #" + ebn + " ]");
    // Read in block
    buffer = new byte[buffer.length];
    for (int i = 0; i < buffer.length; i++) {
    int b = readTimed(1);
    // if EOT - don't worry about the rest of the block.
    if ( (i == 0) && (b == EOT)) {
    buffer[0] = (byte) (b & 0xff);
    break;
    // if CAN - the other side has cancelled the transfer
    if (b == CAN) {
    throw new IOException("cancelled");
    if (b < 0) {
    if (XModem.debug) {
    System.out.println("Time out... NAK'ing");
    out.write(NAK);
    continue recv;
    else {
    buffer[i] = (byte) (b & 0xFF);
    break;
    int type = buffer[0] & 0xff; // either SOH or EOT
    if (type == EOT) {
    if (XModem.debug) {
    System.out.println("EOT!");
    out.write(ACK);
    break;
    int bn = buffer[1] & 0xff; // block number
    int bnc = buffer[2] & 0xff; // one's complement to block #
    if (
    (bn != ebn) && (bn != (ebn - 1)) ||
    (bn + bnc != 255)) {
    if (XModem.debug) {
    System.out.println("NAK'ing type = " + type + " bn = " + bn +
    " ebn = " +
    ebn + " bnc = " + bnc);
    out.write(NAK);
    continue recv;
    byte chksum = buffer[ (buffer.length - 1)];
    byte echksum = 0;
    for (int i = 3; i < (buffer.length - 1); i++) {
    echksum = (byte) ( ( (echksum & 0xff) + (buffer[i] & 0xff)) & 0xff);
    if (chksum != echksum) {
    out.write(NAK);
    continue recv;
    out.write(ACK);
    if (ebn == 255) {
    ebn = 0;
    else {
    ebn++;
    break;
    // We got our block, now save it in our data buffer.
    data = new byte[bs];
    for (int i = 3; i < (buffer.length - 1); i++) {
    data[(i - 3)] = buffer;
    dataPos = 0;
    public synchronized int read() throws IOException {
    // If at the end of our buffer, refill it.
    if (dataPos == bs) {
    try {
    getNextBlock();
    catch (IOException e) {
    throw new IOException();
    // If we're still at end of buffer, say so.
    if ( dataPos == bs) {
    return -1;
    int d = data[dataPos];
    if (d == EOF)
    return -1;
    dataPos++;
    return d;
    * A wrapper around the native read() call that provides the ability
    * to timeout if no data is available within the specified timeout value.
    * @param timeout timeout value in seconds
    * @throws IOException
    * @return int an integer representing the byte value read.
    private int readTimed(int timeout) throws IOException {
    long start = System.currentTimeMillis();
    for (; ; ) {
    if (in.available() > 0) {
    return (in.read());
    try {
    Thread.sleep(10);
    catch (InterruptedException ex) {
    //if (System.currentTimeMillis() - start > timeout * 1000) {
    if (System.currentTimeMillis() - start > timeout * 5000) {
    return -1;
    Here was the output...
    Original file:
    (Commodore CBM SEQ file exported to PC using DirMaster)
    ��
    � �
    � ��� �� �� ��� ��
    � �� �� ���� �� ��� ��
    � ��� ����������������������������������������������
    �� ����� ������� ����� �� ����� ������ ����� ���
    � �� ������ ������ ��� ��� �� ��� ���� �� ������
    � � ���
    ����
    � � ��OWERED BY �OLOR 64 ��� V8
    �UNNING �ETWORK64 V1.26A

    �UPPORTING 38400 �AUD �ATES
    �����/����/�������

    �ESTING �CHO-�ET V1 BETA

    �EATURING �ESSAGES, �ILES,
    �ET�AIL, AND �NLINE �AMES!
    �YS�P: � � � � � � � � �

    �RESS ANY KEY TO LOGIN\C�
    The result when the file was uploaded and received by my XServer:
    ? ? ??OWERED BY ?OLOR 64 ??? V8
    ?UNNING ?ETWORK64 V1.26A
    ?UPPORTING 38400 ?AUD ?ATES
    ?ESTING ?CHO-?ET V1 BETA
    ?EATURING ?ESSAGES, ?ILES,
    ?ET?AIL, AND ?NLINE ?AMES!
    ?YS?P: ? ? ? ? ? ? ? ? ?
    ?RESS ANY KEY TO LOGIN\C?
    The result is different!
    Can someone help me along here... I have been trying to figure out how to do this for approx. a year or so... it has been a very slow process.
    I could use a guru to help me out so I can write the upload and download routines for my Commodore BBS PETSCII Emulation Server.
    Visit http://www.retrogradebbs.com for details.
    Thanks.
    Please help out a dedicated developer who is in over his head...
    -Dave

    Ok. Fair enough. What about general information about Xmodem. This is a hard project because of how obscure the legacy technology is that I am having to implement using Java and MySQL.
    I have two major issues which I have to figure out how to troubleshoot and debug, if possible.
    1. The 23+ blocks exception when a file is being received
    2. The exception which is thrown immediately if I try to receive a binary file instead of an ASCII file.
    I read that telnet is a 7-bit technology and that is why Xmodem, which is an 8-bit technology is not that popular as a viable protocol via telnet, whereas Kermit is, since it was developed for 7-bit systems, i.e. mainframes and minicomputers.
    Is this correct?
    If that is the case, why does www.serio.com have a viable X-Y-ZModem library available (for several hundred $$$ of course) which can be used with both RS-232 serial ports and TCP socket ports? Obviously, it can be done. They are the ONLY company with this library for sale for Java to do this. I cannot justify that $$$ amount for a mere hobby (writing the BBS emulation server for supporting Commodore PETSCII (CG) callers via CGTerm or a native C-64 terminal program using Jim Brain's TCPSER middleware, which emulates a Hayes modem via telnet for telBBSing/retrocomputing.
    I really want to learn how to implement a file transfer protocol, since back in the 80s, I used Xmodem, Punter, Y/Z Modem, etc., a lot to upload and download files via modem at baud rates of 2400, 14.4, 19.2, and 38.4, respectively.
    It's fun to learn how the old skool gurus of telecommunications technology did it. It is one thing to run a BBS which supports these technologies and features, and it is an entirely other thing to learn how to design and develop them yourself for implementation into a project such as I taken on.
    It CAN be done. It WILL be done. However, I have just started my exhaustive research on how it needs to be done. I have read up as much as I could on XModem by Ward C., the father of the protocol.
    But, I have no information to help me figure out why the communications are acting as they do so far.
    Can someone please download the xserver.zip file on my website at:
    www.retrogradebbs.com/projects/xserver.zip
    Compile it. Run it. Connect using HyperTerminal, Netrunner, or another telnet terminal emulation program which supports Xmodem file transfers using WinSock.
    See what happens. With finals due in the next two days, this project will have to be put on hold until after I submit my two final projects.
    If anyone knows what needs to be done to support both ASCII and BINARY file transfers via Xmodem via a socket instead of a modem with RTS/CTS hardware flow control, please respond.
    I know for a fact that this can be done.
    - Dave

  • Getting the data from a TCP/IP packet

    I am dealing with an industrial network that sends and recieves data over TCP/IP between a sort of supervisory system running on Unix and some machines via a bridge that converts messages onto other non TCP/IP networks. This is all old legacy equipment and the bridge now need upgrading. However the original source code is not availiable and no-one is very sure of the messages being sent. I thought it was going to be easy knocking something together in Java to intercept these messages and test various things but have come up against big problems.
    The main problem being that all the data is binary meaning I cant use any of the reader or writer classes I am used too. I am trying to use either DataInputStream or BufferedInputStream to read data in but am struggling. Idealy I need to be able to read (once) the complete data content of each packet that is sent and I need to tell each time a new packet of data arrives so that I can process it as a complete packet. As far as I know there are no eof or eol or any other details that tell me how many bytes of data there are, and they do vary in length, but each packet is a seperate message or message reply.
    I was hoping that there might be someway of getting this information from the TCP/IP layers but cant see how to do it as that all seems to work invisibly. Nor can I see any methods to call on the stream classes that indicate how to tell the lenght of the latest packet or when a new packet has arrived. I am not sure how some of the methods like mark() and reset|() are supposed to be used so am not sure if I couuld use these but am desperate for any help or pointers in the right direction.

    The TCP/IP packets can represent complete messagesThere is no guarantee to this effect anywhere in TCP/IP. Consider the case where a single message requires multiple writes. Consider the case where a write contains the end of one message and the beginning of another. Consider the case where there are multiple messages in a single packet. Consider ... There are just too many of these cases.
    The TCP/IP takes care of numbering the packets so that they can be reasembled in the correct order. Each TCP/IP packet contains information about the size of data the packet contains ...Thank you, I do know how TCP works.
    so in theory if we could get at the TCP/IP layers we should be able to get this information.No. You can get all the packet information out of packets. What you can't get is message information, because it isn't in there. It's in the application protocol, which to TCP/IP is just a stream of bytes. You can get the stream of bytes that the application sent. What it means is up to you.
    I really need to be able to read each packet of data seperately to be able to do anything with itWhy? Given the lack of correlation between writes() and packets and reads() due to TCP streaming, what is the point? And if you want packets you already have them via your sniffer.
    From your first post:
    each packet is a seperate message or message reply.You can't rely on that. There is no guarantee of this anywhere in TCP/IP.
    I also direct your attention to the Nagle algorithm, which coalesces outgoing packets under common conditions.

  • TCP/IP does not let me enable or disable.

    Hi, 
    I am trying to enable TCP/IP in order to access my SQL server remotely but when I select tcp/ip and want to enable = Yes or disabled = no it does not give me the option, it appears a gray empty rectangle. 
    Any idea what might happen?, I will like to post a picture but it does not let me at the moment
    Thank you,

    This one may help.
    Enable Named Pipes and TCP/IP Connections
     Might also ask them over here.
    SQL Server forums on MSDN
    Regards, Dave Patrick ....
    Microsoft Certified Professional
    Microsoft MVP [Windows]
    Disclaimer: This posting is provided "AS IS" with no warranties or guarantees , and confers no rights.

  • Lync 2013 mobile app does not work internally, SIP domain is Different than users UPN. not sure if that matters.

    using the lync client connectivity tester on a pc on the same lan as my mobile client everything is green and it says its ready for use.
    using my android galaxy s5 client on wifi on the same lan i get a screen with waiting to sign in spinning and an error at the top "we cant connect to the server check your network connection and server address, and try again."
    i have uploaded the full client log files
    here: client log file
    some errors that stand out from this log file are:
    1. ERROR HttpEngine: Certificate check fails: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
    2. <h2>401 - Unauthorized: Access is denied due to invalid credentials.</h2>
      <h3>You do not have permission to view this directory or page using the credentials that you supplied.</h3>
    i am using the correct creds, same creds i used on the analyzer tool.
    in the analyzer tool i did have to fill in the username field because my sip domain is different then my users UPN. which from what ive read its required to use the username field.
    i also filled in the username field in the mobile app with domain\username
    3. ERROR LYNC: ERROR TRANSPORT /Volumes/ServerHD2/buildagent/workspace/200604/tps/ucmp/platform/networkapis/privateandroid/CHttpConnection.cpp/295:CHttpConnection exception: java.lang.NullPointerException
    Jan 14, 2015 8:40:49 AM INFO LYNC: INFO TRANSPORT /Volumes/ServerHD2/buildagent/workspace/200604/tps/ucmp/ucmp/transport/requestprocessor/private/CHttpRequestProcessor.cpp/173:Received response of request(UcwaAutoDiscoveryRequest) with status = 0x22020001
    Jan 14, 2015 8:40:49 AM INFO LYNC: INFO TRANSPORT /Volumes/ServerHD2/buildagent/workspace/200604/tps/ucmp/ucmp/transport/requestprocessor/private/CHttpRequestProcessor.cpp/201:Request UcwaAutoDiscoveryRequest resulted in E_ConnectionError (E2-2-1). The retry
    counter is: 0
    4. Jan 14, 2015 8:40:50 AM ERROR LYNC: ERROR TRANSPORT /Volumes/ServerHD2/buildagent/workspace/200604/tps/ucmp/ucmp/transport/authenticationresolver/private/CAuthenticationResolver.cpp/431:Failing the original request as we weren't able to get the token
    this is the same type of error i was getting in the lync connectivity analyzer until i filled in the username field. but its filled in, in my client.
    again you can see the full log file is `HERE
    thank you in advance for any help. im trying to get internal working before i try external.

    Eric,
    I am trying to configure a reverseproxy on my netscaler which is in a 2 arm mode(dmz/internal) but I keep getting an error when configuring the monitor.
    i used this guide to configure it
    http://www.lynced.com.au/2014/04/configure-citrix-netscaler-vpx-as.html
    but continue to get this error in the netscaler monitor "Failure - TCP connection successful, but application timed out"
    so the virtual server is never up, thinking about just changing it to tcp as a monitor so it stays up and i can at lesat get the vip up.
    Also your link to the diagram shows it going to the reverse  proxy but the one im using has it going directly to the front end servers.
    http://www.lync-solutions.com/Documents/Lync_2013_protocol_poster_v6_7.pdf
    I'm guessing Microsoft's is the correct one but wonder why the config differential?
    I see that your diagram says "mobility url", what is the mobility url? i though that was the lyncdiscoverinternal.internal.com
    current setup is
    2 fe servers on internal
    1 edge server on dmz
    1 almost done reverse proxy netscaler load balancer.
    also this ms link i used to configure dns entries, along with the pdf linked above.
    http://technet.microsoft.com/en-us/library/jj945644.aspx
    i currently have these external dns entries and they all point to the edge server on the dmz.
    dialin .external.com
    lync .external.com
    lyncweb .external.com
    lyncdiscover.external.com
    meet .external.com
    sip .external.com
    webconf .external.com
    av .external.com
    _autodiscover._tcp.external.com.
    the internal dns links point to 1 of the front end servers
    1. lyncdiscoverinternal.internal.com
    2. lyncdiscover.internal.com
    3. _sipinternaltls._tcp.internal.com
    4. _sipinternal._tcp.internal.com
    5. sipinternal.internal.com
    6. sip.internal.com
    thanks again for your help.

  • 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.

  • Jabber 9.2 Failback from TCP 5222 to TCP 443

    Hi all,
    if i check the deployment guide for J4W i see that it supports failback to https, if XMPP (TCP 5222) is not available.
    http://www.cisco.com/en/US/docs/voice_ip_comm/jabber/Windows/9_2/JABW_BK_C9731738_00_jabber-windows-install-config_chapter_010.html#JABW_RF_P3E0FDE4_00
    We have noticed that the feature is not available in our cloud based deployment.
    Do i have to enable eny specific setting in Webex Connect Admin?
    Any other experiences?
    Steffen

    One of us does not understand the feature.
    Of course is 5222 blocked, because I want to see jabber doing a fail back to https.
    Do I misunderstand the fail back?
    Sent from Cisco Technical Support iPad App

  • ASA 5505:Static Routing and Deny TCP connection because of bad flag

    Hi Everybody,
    I have a problem. I made a VPN site-2-site with 2 ASA 5505. The VPN works great. And I create a redondant link if the VPN failed.
    In fact, I use Dual ISP with route tracking. If the VPN fails, the default route change to an ISDN router, situated on the inside interface.
    When I simulated a VPN fail, the ASAs routes switch automatically on backup ISDN routers. If I ping elements, it works great. But when i try TCP connection like telnet, the ASAs deny connections:
    %PIX|ASA-6-106015: Deny TCP (no connection) from 172.16.10.57/35066 to 172.16.18.1/23 flags tcp_flags on interface interface_name.
    the security appliance discarded a TCP packet that has no associated connection in the security appliance connection table. The security appliance looks for a SYN flag in the packet, which indicates a request to establish a new connection. If the SYN flag is not set, and there is not an existing connection, the security appliance discards the packet.
    thanks!
    EDIT: On the schema, The interface of the main asa is 172.16.18.148...

    Check if the xlate timer is set greater than or equal to what the conn timer, so as not to have connections waiting on xlates that no longer exist. To minimize the number of attempts, enable "service resetinbound" . The PIX will reset the connection and make it go away. Without service resetinbound, the PIX Firewall drops packets that are denied and generates a syslog message stating that the SYN was a denied connection.

Maybe you are looking for

  • How can I find and install adobe flash player for ipad2

    I was try find but can't find flash player,,,,

  • Nokia Lumia 925 updating

    I just purchased my Nokia Lumia 925 today, and it doesn't come with GDR3. So i tried to update the phone and it constantly gives me the 801881do error stating it cannot update. What does this error mean and what could i do to fix it?? Thanks to any h

  • Acrobat 8 "stopped working". Activation issue?

    I am using (ahem, trying to use) Acrobat 8.1 Professional on Windows Vista. I never had any problems with it, but starting a few days ago, whenever I'd start my computer, I'd get a message saying that AcroTray had stopped working and needed to close.

  • Changing of byte value

    byte value is -128 to 127 i want to make it 0 to 255 the return result must be in byte form is it possible? how? can bit mapping work? tq

  • Apps won't sync after windows 7 install

    Everything else seems to sync just fine. Apps show up in itunes but when I try to click on them and apply it goes through the motions but won't put them on the phone. Anyone have a clue of what I am doing wrong?