Unanswered data transfer thru gprs in vb.net

  • Wednesday, June 01, 2011 8:43 AM
     
     

    hi,

     can any one tell me how to transfer data through gprs to a oracle server using vb .net

    i am using this coding below

     

    IPHostEntry ServerEntry;
                TcpClient Client = new TcpClient();
                Stream SocketStream;
                Byte[] InputData = new Byte[256];
                
                try
                {
                                   ServerEntry = Dns.GetHostEntry("169.254.2.2");
     

                }
                catch (SocketException SExp)
                {
                    if (SExp.ErrorCode == 11001) // No such host is known
                    {
                                            Console.WriteLine("Server Not Known");
                        Console.WriteLine(SExp.Message);
                    }
                    else
                    {
                                            Console.WriteLine("DNS Entry is not valid");
                        Console.WriteLine(SExp.Message);
                    }
                    return;

                }
                
                try
                {
                    Client.Connect("169., Convert.ToInt32(ConfigurationReader.GetFileValue("PortNumber")));
                    SocketStream = Client.GetStream();
                    InputData = Encoding.ASCII.GetBytes(ConfigurationReader.GetFileValue("Message").ToCharArray());
                    SocketStream.Write(InputData, 0, InputData.Length);
                    SocketStream.Flush();
                }
                catch (Exception WriteExcp)
                {
                  Console.WriteLine(WriteExcp.Message);
                    
                    return;
                }
                bool ServerFlag = true;
                while (ServerFlag)
                {
                    if (true == Client.GetStream().DataAvailable)
                    {
                        Client.GetStream().Read(InputData, 0, InputData.Length);
                        SocketStream.Flush();
                        Console.WriteLine(Encoding.ASCII.GetString(InputData,0,InputData.Length));
                                           ServerFlag = false;
                    }
                }
            }

    advance thanks

All Replies

  • Wednesday, June 01, 2011 8:48 AM
     
     

    Maybe, but hopefully they don't abuse this forum with C# code.

    Try the neighbors instead

    http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral

     


    Success
    Cor
  • Wednesday, June 01, 2011 8:59 AM
     
     
    If you are using VB.NET then the code you have posted there is in C#

    - did you get it from another site?


    Or are you confusing Visual Studio .NET (the environment you design and code in) with Visual Basic - one of several languages you can use within Visual studio?


    If its C# you are wanting / supposed to be coding in then please see the link in Cors post :)

  • Wednesday, June 01, 2011 10:27 AM
     
     

    thanks Mr.JACK

    please can u help me to get the vb.net coding

    yes i got that coding from other site

    advance thanks

  • Wednesday, June 01, 2011 11:09 AM
     
     

    To start i would convert the code to vb.net and then put it back in your project, and rework it there to make it work with your project.

    Try: http://www.developerfusion.com/tools/convert/csharp-to-vb/

    to get started.