Client retrive data RRS feed

  • Question

  • Hi guys

    i have a machine A is a linux computer with ip and port 8001

    i donno is he listening or not so i just use a tcpclient to talk with this machine.

    linux computer contain a database table data which i need to retrive. from the documentation is a file 51 in hexadecimal value.  below is my code for more detail.

    so how do  i tell the linux computer to send me the file tat i wanted?

     Dim clientsocket As New TcpClient("", 8001)
            Dim serverStream As NetworkStream = clientSocket.GetStream()
            Dim outStream As Byte() = System.Text.Encoding.ASCII.GetBytes(&H51) '51 is the file of retrive item
            serverStream.Write(outStream, 0, outStream.Length)
            MessageBox.Show("msg send out" & outStream.ToString())
            Dim inStream(10024) As Byte
            serverStream.Read(inStream, 0, inStream.Length)
            Dim returndata As String = System.Text.Encoding.ASCII.GetString(inStream)
            MessageBox.Show("Data from Server : " + returndata)

    Thursday, April 4, 2013 6:57 AM

All replies

  • Instead of using TCP I would use one of the TCP application classes FTP which is FTPWEbRequest and download the file.  A linux machine should have FTP working.  To verify that you can download in your IE put the following into the URL :

    FTP://        Note I used FTP instead of HTTP

    Or you can put the same URL into a Windows Explorer

    Thursday, April 4, 2013 12:59 PM
  • Hi,

    thanks for ur reply.

    can u explain more of this FTP stuff?when i click on ur link, i appeared the name,size and date. so how do i retrive the data using ftp??

    Friday, April 5, 2013 1:20 AM
  • I want to make sure the website allowed FTP and also to find out if credentials were required at the website (uier id and password).  You only require credentials if you needed credentials when using a IE.  Some ftp sites allow an anonymous users without credentials.  Normally these sites use as a user ID either of "FTP" or "Anonymous" and will indicate what password to use.  Occassionally (expecial unix websites) will use "FTP" for both the user id and password.

    See website below for an example.  Don't use credentials if you didn't require with the IE.  Instead replace the following line

    From : request.Credentials = new NetworkCredential("anonymous", "");

    To : request.UseDefaultCredentials =



    Friday, April 5, 2013 2:59 AM
  • Humm... When his question contains a remote port number that's not an obvious FTP port, how can you suggest to use FtpWebRequest instead?

    It's not even clear that the "data" he want to download is a physical file. (Notice he does mentioned the data he wished to download from the remote server is "database table data")

    Friday, April 5, 2013 8:23 AM
  • Please clarify what kind of service is listening on port 8001.

    I'm half expecting it's something like MySql Server or some kind of file server implementation. Different service means different code to retrieve data (e.g. reading blob data from a table, or code for some handshake / download data)

    Friday, April 5, 2013 9:20 AM