Results 1 to 17 of 17

Thread: [RESOLVED] send a text file to server

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2001
    Location
    Earth
    Posts
    762

    Resolved [RESOLVED] send a text file to server

    hi, i have an pda application that generate some text files.
    how can i send them to the server???

    thanks
    Last edited by shahid; Jun 28th, 2006 at 03:59 AM. Reason: resolved

  2. #2
    Frenzied Member
    Join Date
    Oct 2005
    Posts
    1,286

    Re: send a text file to server

    FTP, Web Service, custom server, RAPI

    You have a big choice

    Pete

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2001
    Location
    Earth
    Posts
    762

    Re: send a text file to server

    can u plz give me the codes for web services

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2001
    Location
    Earth
    Posts
    762

    Re: send a text file to server

    hello any budy help plz

  5. #5
    Fanatic Member Strider's Avatar
    Join Date
    Sep 2004
    Location
    Dublin, Ireland
    Posts
    612

    Re: send a text file to server

    using the Winint.dll you can use FTP
    find more about it here
    http://www.teksoftco.com/articles/ftp%20client.htm

    RAPI you will need create a desktop application that will pull the file across over activesync
    Barry


    Visual Studio .NET 2008/Visual Studio .NET 2005/Visual Studio .NET 2003
    .NET Framework 3.0 2.0 1.1/ASP.Net 3.0 2.0 1.1/Compact Framework 1.0

    SQL Server 2005/2000/SQL Server CE 2.0


    If you like, rate this post

    Compact Framework for Beginners

  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2001
    Location
    Earth
    Posts
    762

    Re: send a text file to server

    thx m8..but i didnt get any thing by it.
    is there any way to sending data from pda to server ...by vb.net...using http protocols....

  7. #7
    Fanatic Member Strider's Avatar
    Join Date
    Sep 2004
    Location
    Dublin, Ireland
    Posts
    612

    Re: send a text file to server

    from doing a search on google i found this
    http://forums.asp.net/thread/1082923.aspx
    Barry


    Visual Studio .NET 2008/Visual Studio .NET 2005/Visual Studio .NET 2003
    .NET Framework 3.0 2.0 1.1/ASP.Net 3.0 2.0 1.1/Compact Framework 1.0

    SQL Server 2005/2000/SQL Server CE 2.0


    If you like, rate this post

    Compact Framework for Beginners

  8. #8

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2001
    Location
    Earth
    Posts
    762

    Re: send a text file to server

    it's nice but work with asp.net pages... i am using vb.net on PDA ...

    not good for me.

  9. #9

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2001
    Location
    Earth
    Posts
    762

    Re: send a text file to server

    if i have two pages on server...1 for file selection 2 for save the file...as we use in asp/asp.net to upload files on server thru http protocol....

    so can i call the 2nd file thru vb.net...via httprequest object...but how i fill the data (if i run it from server i shud use file1 for file selection...)

    hope i get a hint/solution.
    thaks

  10. #10
    PowerPoster
    Join Date
    Aug 2003
    Location
    Edinburgh, UK
    Posts
    2,773

    Re: send a text file to server

    you are best to transmit the data via network stream and then the server application to save the data recieved to text file

    MVP 2007-2010 any chance of a regain?
    Professional Software Developer and Infrastructure Engineer.

  11. #11

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2001
    Location
    Earth
    Posts
    762

    Re: send a text file to server

    is there any solutions to do it??? using XML SOAP etc etc..????

  12. #12
    PowerPoster
    Join Date
    Aug 2003
    Location
    Edinburgh, UK
    Posts
    2,773

    Re: send a text file to server

    I've just given you a solution.

    MVP 2007-2010 any chance of a regain?
    Professional Software Developer and Infrastructure Engineer.

  13. #13
    Fanatic Member Strider's Avatar
    Join Date
    Sep 2004
    Location
    Dublin, Ireland
    Posts
    612

    Re: send a text file to server

    Quote Originally Posted by shahid
    is there any solutions to do it??? using XML SOAP etc etc..????

    If you use webservices you are using xml and soap
    Barry


    Visual Studio .NET 2008/Visual Studio .NET 2005/Visual Studio .NET 2003
    .NET Framework 3.0 2.0 1.1/ASP.Net 3.0 2.0 1.1/Compact Framework 1.0

    SQL Server 2005/2000/SQL Server CE 2.0


    If you like, rate this post

    Compact Framework for Beginners

  14. #14

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2001
    Location
    Earth
    Posts
    762

    Re: send a text file to server

    i can not use application on the server...
    how i use web service for this purpose?

  15. #15
    Fanatic Member Strider's Avatar
    Join Date
    Sep 2004
    Location
    Dublin, Ireland
    Posts
    612

    Re: send a text file to server

    Quote Originally Posted by shahid
    i can not use application on the server...
    what cant you use on the server?

    Quote Originally Posted by shahid
    how i use web service for this purpose?
    i've posted a link in earlier post
    Barry


    Visual Studio .NET 2008/Visual Studio .NET 2005/Visual Studio .NET 2003
    .NET Framework 3.0 2.0 1.1/ASP.Net 3.0 2.0 1.1/Compact Framework 1.0

    SQL Server 2005/2000/SQL Server CE 2.0


    If you like, rate this post

    Compact Framework for Beginners

  16. #16

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2001
    Location
    Earth
    Posts
    762

    Resolved Re: send a text file to server

    the follwoing code send data to the server thru querystring...where the asp file on server will get it and save a text file.
    (if you are behind the proxy then ON the proxy codes)
    also the lstresult for showing the result.
    hope it's help

    VB Code:
    1. Dim b As String = "name_" & Now.Date & ".txt"
    2.         b = Replace(b, "/", "-")
    3.         Dim url As String = "http://www.myurl.net/file.asp?a=" & strData & "&b=" & b
    4.  
    5.         Try
    6.             '    If Not "".Equals(txtProxy.Text) Then
    7.             'Dim proxyObject As New WebProxy(proxy, 80)
    8.  
    9.             ' Disable proxy use when the host is local.
    10.             'proxyObject.BypassProxyOnLocal = True
    11.  
    12.             ' HTTP requests use this proxy information.
    13.             'GlobalProxySelection.Select = proxyObject
    14.             'End If
    15.  
    16.             Dim req As WebRequest = WebRequest.Create(url)
    17.             Dim result As WebResponse = req.GetResponse()
    18.             Dim ReceiveStream As Stream = result.GetResponseStream()
    19.             Dim encode As Encoding = System.Text.Encoding.GetEncoding("utf-8")
    20.             Dim sr As New StreamReader(ReceiveStream, encode)
    21.  
    22.             ' Read the stream into arrays of 30 characters
    23.             ' to add as items in the list box. Repeat until
    24.             '' buffer is read.
    25.             Dim read(29) As [Char]
    26.             Dim count As Integer = sr.Read(read, 0, 30)
    27.             While count > 0
    28.                 Dim astr As New String(read, 0, count)
    29.                 lstresults.Text = lstresults.Text & astr
    30.                 count = sr.Read(read, 0, 30)
    31.                 If astr = "done" Then
    32.                     btnOK.Enabled = True
    33.                     btnRetry.Enabled = False
    34.                 End If
    35.             End While
    36.             'Return True
    37.  
    38.  
    39.         Catch ex As WebException
    40.             Dim message As String = ex.Message
    41.             Dim response As HttpWebResponse = CType(ex.Response, HttpWebResponse)
    42.             If Nothing Is response Then
    43.             Else
    44.                 message = response.StatusDescription
    45.                 response.Close()
    46.             End If
    47.             btnRetry.Enabled = True
    48.             btnOK.Enabled = False
    49.             'Return False
    50.             lstresults.Text = lstresults.Text & vbCrLf & message
    51.  
    52.         Catch ex As Exception
    53.             'Return False
    54.             lstresults.Text = lstresults.Text & vbCrLf & ex.Message
    55.         End Try
    56.         '=============================end of http url==================================

  17. #17

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2001
    Location
    Earth
    Posts
    762

    Re: send a text file to server

    the following codes send the data to the server thru query string..where the server page get it and save as a text file.
    unblock the proxy if u behind the proxy server.
    put a lstresult (listbox) before run it.
    hope it's help

    VB Code:
    1. Dim b As String = "auditor_" & Now.Date & ".txt"
    2.         b = Replace(b, "/", "-")
    3.         Dim url As String = "http://myserver.com/file.asp?a=" & strData & "&b=" & b
    4.  
    5.         Try
    6.             '    If Not "".Equals(txtProxy.Text) Then
    7.             'Dim proxyObject As New WebProxy(proxy, 80)
    8.  
    9.             ' Disable proxy use when the host is local.
    10.             'proxyObject.BypassProxyOnLocal = True
    11.  
    12.             ' HTTP requests use this proxy information.
    13.             'GlobalProxySelection.Select = proxyObject
    14.             'End If
    15.  
    16.             Dim req As WebRequest = WebRequest.Create(url)
    17.             Dim result As WebResponse = req.GetResponse()
    18.             Dim ReceiveStream As Stream = result.GetResponseStream()
    19.             Dim encode As Encoding = System.Text.Encoding.GetEncoding("utf-8")
    20.             Dim sr As New StreamReader(ReceiveStream, encode)
    21.  
    22.             ' Read the stream into arrays of 30 characters
    23.             ' to add as items in the list box. Repeat until
    24.             '' buffer is read.
    25.             Dim read(29) As [Char]
    26.             Dim count As Integer = sr.Read(read, 0, 30)
    27.             While count > 0
    28.                 Dim astr As New String(read, 0, count)
    29.                 lstresults.Text = lstresults.Text & astr
    30.                 count = sr.Read(read, 0, 30)
    31.                 If astr = "done" Then
    32.                     btnOK.Enabled = True
    33.                     btnRetry.Enabled = False
    34.                 End If
    35.             End While
    36.             'Return True
    37.  
    38.  
    39.         Catch ex As WebException
    40.             Dim message As String = ex.Message
    41.             Dim response As HttpWebResponse = CType(ex.Response, HttpWebResponse)
    42.             If Nothing Is response Then
    43.             Else
    44.                 message = response.StatusDescription
    45.                 response.Close()
    46.             End If
    47.             btnRetry.Enabled = True
    48.             btnOK.Enabled = False
    49.             'Return False
    50.             lstresults.Text = lstresults.Text & vbCrLf & message
    51.  
    52.         Catch ex As Exception
    53.             'Return False
    54.             lstresults.Text = lstresults.Text & vbCrLf & ex.Message
    55.         End Try
    56.         '=============================end of http url==================================

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width