Results 1 to 7 of 7

Thread: VB application to communicate to a SOHO router

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2006
    Posts
    10

    VB application to communicate to a SOHO router

    Hi

    I am trying to develop an application in VB 6, in which i want the application to communicate to the Router, I want the application to communicate with the router inorder to read out some information from it like the log file that the router generates.
    The router is using LINUX kernel.
    any help from the forums guys would be highly appreciated

    Regards

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: VB application to communicate to a SOHO router

    Moved from Application Development

  3. #3
    Addicted Member
    Join Date
    Mar 2006
    Posts
    178

    Re: VB application to communicate to a SOHO router

    If you are using TCP/IP routers usually require packets that are in network byte order. Therefore don't forget to swap the bits when you send data to the router.

    I can help with this if you require more info.

  4. #4

    Thread Starter
    New Member
    Join Date
    Jun 2006
    Posts
    10

    Re: VB application to communicate to a SOHO router

    Yes sir definetly i need help from you.

    I have done it with parsing the HTML pages the router generates.

    The main problem i am facing is to pass through authentication the router requires.
    I you have any similar project kindly share it with me.

    Thanks for anticipation.

  5. #5
    Addicted Member
    Join Date
    Mar 2006
    Posts
    178

    Re: VB application to communicate to a SOHO router

    I don't have a router project as such.

    Are you able to communicate with the router directly?

    When I said I can help you - I meant with the bit swapping.

  6. #6

    Thread Starter
    New Member
    Join Date
    Jun 2006
    Posts
    10

    Re: VB application to communicate to a SOHO router

    Ok thanks alot for all your help

    I have done that, now what i want is the result of IPCONFIG/ALL to be displayed in my application i-e i want to run this command through my application and then display its result in a text box, can you please let me know what API to call and how?

    thanks for all your time and anticipation

  7. #7
    Addicted Member
    Join Date
    Mar 2006
    Posts
    178

    Re: VB application to communicate to a SOHO router

    What this does is create a console, it accepts text from the console which is then displayed in a form.

    I'm sure you could customize this to your needs.

    VB Code:
    1. Private Const FOREGROUND_BLUE = &H1
    2. Private Const FOREGROUND_GREEN = &H2
    3. Private Const FOREGROUND_RED = &H4
    4. Private Const BACKGROUND_BLUE = &H10
    5. Private Const BACKGROUND_GREEN = &H20
    6. Private Const BACKGROUND_RED = &H40
    7. Private Const BACKGROUND_INTENSITY = &H80&
    8. Private Const BACKGROUND_SEARCH = &H20&
    9. Private Const FOREGROUND_INTENSITY = &H8&
    10. Private Const FOREGROUND_SEARCH = (&H10&)
    11. Private Const ENABLE_LINE_INPUT = &H2&
    12. Private Const ENABLE_ECHO_INPUT = &H4&
    13. Private Const ENABLE_MOUSE_INPUT = &H10&
    14. Private Const ENABLE_PROCESSED_INPUT = &H1&
    15. Private Const ENABLE_WINDOW_INPUT = &H8&
    16. Private Const ENABLE_PROCESSED_OUTPUT = &H1&
    17. Private Const ENABLE_WRAP_AT_EOL_OUTPUT = &H2&
    18. Private Const STD_OUTPUT_HANDLE = -11&
    19. Private Const STD_INPUT_HANDLE = -10&
    20. Private Const STD_ERROR_HANDLE = -12&
    21. Private Const INVALID_HANDLE_VALUE = -1&
    22. Private Declare Function AllocConsole Lib "kernel32" () As Long
    23. Private Declare Function FreeConsole Lib "kernel32" () As Long
    24. Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
    25. Private Declare Function GetStdHandle Lib "kernel32" (ByVal nStdHandle As Long) As Long
    26. Private Declare Function WriteConsole Lib "kernel32" Alias "WriteConsoleA" (ByVal hConsoleOutput As Long, lpBuffer As Any, ByVal nNumberOfCharsToWrite As Long, lpNumberOfCharsWritten As Long, lpReserved As Any) As Long
    27. Private Declare Function ReadConsole Lib "kernel32" Alias "ReadConsoleA" (ByVal hConsoleInput As Long, ByVal lpBuffer As String, ByVal nNumberOfCharsToRead As Long, lpNumberOfCharsRead As Long, lpReserved As Any) As Long
    28. Private Declare Function SetConsoleTextAttribute Lib "kernel32" (ByVal hConsoleOutput As Long, ByVal wAttributes As Long) As Long
    29. Private Declare Function SetConsoleTitle Lib "kernel32" Alias "SetConsoleTitleA" (ByVal lpConsoleTitle As String) As Long
    30. Private hConsoleOut As Long, hConsoleIn As Long, hConsoleErr As Long
    31. Private Sub Form_Load()
    32.     'KPD-Team 2001
    33.     'URL: [url]http://www.allapi.net/[/url]
    34.     'E-Mail: [email][email protected][/email]
    35.     'Create console
    36.     If AllocConsole() Then
    37.         hConsoleOut = GetStdHandle(STD_OUTPUT_HANDLE)
    38.         If hConsoleOut = INVALID_HANDLE_VALUE Then MsgBox "Unable to get STDOUT"
    39.         hConsoleIn = GetStdHandle(STD_INPUT_HANDLE)
    40.         If hConsoleOut = INVALID_HANDLE_VALUE Then MsgBox "Unable to get STDIN"
    41.     Else
    42.         MsgBox "Couldn't allocate console"
    43.     End If
    44.     'Set the caption of the console window
    45.     SetConsoleTitle "The KPD-Team 2001"
    46.     'Set the background color of the text in the console to bright YELLOW text
    47.     'on a BLUE background
    48.     SetConsoleTextAttribute hConsoleOut, FOREGROUND_RED Or FOREGROUND_GREEN Or FOREGROUND_INTENSITY Or BACKGROUND_BLUE
    49.     'Write something in the console
    50.     ConsoleWriteLine "Hello World!"
    51.     ConsoleWrite "Please enter your name: "
    52.     'Ask for user input and show it in the caption
    53.     Me.Caption = "Your name: " + ConsoleReadLine()
    54. End Sub
    55. Private Sub Form_Unload(Cancel As Integer)
    56.     'Delete console
    57.     CloseHandle hConsoleOut
    58.     CloseHandle hConsoleIn
    59.     FreeConsole
    60. End Sub
    61. Sub ConsoleWriteLine(sInput As String)
    62.      ConsoleWrite sInput + vbCrLf
    63. End Sub
    64. Sub ConsoleWrite(sInput As String)
    65.      Dim cWritten As Long
    66.      WriteConsole hConsoleOut, ByVal sInput, Len(sInput), cWritten, ByVal 0&
    67. End Sub
    68. Function ConsoleReadLine() As String
    69.     Dim ZeroPos As Long
    70.     'Create a buffer
    71.     ConsoleReadLine = String(10, 0)
    72.     'Read the input
    73.     ReadConsole hConsoleIn, ConsoleReadLine, Len(ConsoleReadLine), vbNull, vbNull

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