locked
Help me - With connection GPRS RRS feed

  • Question

  • I use the code to connect to GPRS:

     

     // Create a new 'Uri' object with the specified string.
    
    
     Uri myUri = new
    
     Uri("http://www.contoso.com"
    
    );
     // Create a new request to the above mentioned URL.	
    
    
     WebRequest myWebRequest = WebRequest.Create(myUri);
     // Assign the response object of 'WebRequest' to a 'WebResponse' variable.
    
    
     WebResponse myWebResponse = myWebRequest.GetResponse();
    
    

     

    I execute send with code:

     

     try
    
    
     {
     FTPFactory ff = new
    
     FTPFactory();
     ff.setBinaryMode(true
    
    );
     ff.upload(arquivo + "\\EXPORTAR"
    
     + sequencia + ".ZIP"
    
    );
     }
     catch
    
     (Exception ex)
     {
     MessageBox.Show("Erro ao enviar arquivo."
    
    );
     ftp_Operacao = false
    
    ;
     }
    
    

     

    I've a problem, to connect with GPRS, when I will send file to FTP the code break in this line:

    ---->  bytes = clientSocket.Receive(buffer, buffer.Length, 0);
    

    I'm using the FTPFactory to send files to FTP, anyone help me plz...

    • Changed type Cicero Diego Tuesday, October 19, 2010 6:00 PM
    • Changed type Cicero Diego Tuesday, October 19, 2010 6:00 PM
    Tuesday, October 19, 2010 1:43 PM

All replies

  • Hi,

    Are you getting GPRS connectivity on your device? If not please use this code to automatically connect to GPRS.

        public static bool IsWebAccessible() // Call this class as follows: bool bResponse = Net.IsWebAccessible();
        {
          HttpWebRequest hwrRequest;
          HttpWebResponse hwrResponse;
    
          string strUrl = @"http://www.google.com/";
          bool bConnected = false;
    
          try
          {
            hwrRequest = (HttpWebRequest)WebRequest.Create(strUrl);
            hwrResponse = (HttpWebResponse)hwrRequest.GetResponse();
    
            if (hwrResponse.StatusCode == HttpStatusCode.OK)
            {
              bConnected = true;
            }
          }
          catch (WebException we)
          {
            bConnected = false;
          }
          catch (Exception ex)
          {
            bConnected = false;
          }
          finally 
          {
            hwrRequest = null;
            hwrResponse = null;
          }
    
          return bConnected;
        }
    
    

    Please let me know if my understanding is wrong.

    Regards,

    Malleswar

    Wednesday, October 20, 2010 4:31 AM
  • Malleswar I connect in ftp but my problem is when I send a file to FTP
    Wednesday, October 20, 2010 11:52 AM
  • Hi,

    What error message do you get?

     

    Best regards,
    Guang-Ming Bian - MSFT


    Please remember to mark the replies as answers if they help and unmark them if they provide no help
    Thursday, October 21, 2010 8:50 AM
  • MSFT dont have error message. When the system come on line 

    bytes = clientSocket.Receive(buffer, buffer.Length, 0);

    it is running and does not pass to the next row.
    If you want I can take the code here to you.

    Thursday, October 21, 2010 11:43 AM
  • I need help plz!

    I can't solve this problem.

    Friday, October 22, 2010 4:02 PM
  • Hi,

    I think that your problem stay on the ftp side, probably the request to the ftp server go in timeout and your software wait infinitely for an answer that never arrive.

    I suggest you to see from the console of the ftp server what's happen when you try to connect.

    Check also the type of ftp connection, passive mode, or active mode. In many case setting passive mode resolve.

     

    Saturday, October 23, 2010 12:36 PM
  • Hi,

    In addition to Cicero's suggestion, I suggest you debug server and client to find the issue. Setting breakpoints in server and client code, debug line by line.

     

    Best regards,
    Guang-Ming Bian - MSFT


    Please remember to mark the replies as answers if they help and unmark them if they provide no help
    Monday, October 25, 2010 3:20 AM