Visual Basic, .NET, ASP, VBScript
 

   
   
     

Форум - VBA

Страница: 1 | 2 |

 

  Вопрос: Друзья Добавлено: 25.01.07 08:42  

Автор вопроса:  Makes

Ответить

  Ответы Всего ответов: 21  

Номер ответа: 16
Автор ответа:
 Makes



Вопросов: 8
Ответов: 36
 Профиль | | #16 Добавлено: 26.01.07 17:09
Совет очень хороший. Спасибо. Решил сначала посмотреть инет статистику, а уж потом ее менять. Использую такой код:
Private Declare Function GetTcpStatistics Lib "iphlpapi.dll" (pStats As MIB_TCPSTATS) As Long

Private Type MIB_TCPSTATS
    dwRtoAlgorithm As Long '// timeout algorithm
    dwRtoMin As Long       '// minimum timeout
    dwRtoMax As Long       '// maximum timeout
    dwMaxConn As Long      '// maximum connections
    dwActiveOpens As Long  '// active opens
    dwPassiveOpens As Long '// passive opens
    dwAttemptFails As Long '// failed attempts
    dwEstabResets As Long  '// establised connections reset
    dwCurrEstab As Long    '// established connections
    dwInSegs As Long       '// segments received
    dwOutSegs As Long      '// segment sent
    dwRetransSegs As Long  '// segments retransmitted
    dwInErrs As Long       '// incoming errors
    dwOutRsts As Long      '// outgoing resets
    dwNumConns As Long     '// cumulative connections
End Type
 
Private Sub Timer1_Timer()
    UpdateStats
End Sub
 
Private Sub UpdateStats()

    Dim tStats          As MIB_TCPSTATS
    Dim lRetValue As Long

    lRetValue = GetTcpStatistics(tStats)

    List1.Clear
    List1.AddItem "Timeout algorithm: " & tStats.dwRtoAlgorithm
    List1.AddItem "Minimum timeout: " & tStats.dwRtoMin
    List1.AddItem "Maximum timeout: " & tStats.dwRtoMax
    List1.AddItem "Maximum connections: " & tStats.dwMaxConn
    List1.AddItem "Active opens: " & tStats.dwActiveOpens
    List1.AddItem "Passive opens: " & tStats.dwPassiveOpens
    List1.AddItem "Failed attempts: " & tStats.dwAttemptFails
    List1.AddItem "Establised connections reset: " & tStats.dwEstabResets
    List1.AddItem "Established connections: " & tStats.dwCurrEstab
    List1.AddItem "Segments received: " & tStats.dwInSegs
    List1.AddItem "Segment sent: " & tStats.dwOutSegs
    List1.AddItem "Segments retransmitted: " & tStats.dwRetransSegs
    List1.AddItem "Incoming errors: " & tStats.dwInErrs
    List1.AddItem "Outgoing resets: " & tStats.dwOutRsts
    List1.AddItem "Cumulative connections: " & tStats.dwNumConns

End Sub


Есть ли описание для SetIpStatistics и GetIpStatistics?

Ответить

Номер ответа: 17
Автор ответа:
 Makes



Вопросов: 8
Ответов: 36
 Профиль | | #17 Добавлено: 26.01.07 18:15
Нашел для GetIpStatistics. Но никакие данные, возвращаемые этой функцией, не указывают на количество принятых/отправленных байт. Значит функцией SetIpStatistics не получится изменить эти самые байты.

Option Explicit

Private Declare Function GetIpStatistics Lib "iphlpapi.dll" (pStats As MIB_TCPSTATS) As Long

Private Type MIB_TCPSTATS
  dwForwarding As Long '// IP forwarding enabled or disabled
  dwDefaultTTL As Long '// default time-to-live
  dwInReceives As Long '// datagrams received
  dwInHdrErrors As Long '// received header errors
  dwInAddrErrors As Long '// received address errors
  dwForwDatagrams As Long '// datagrams forwarded
  dwInUnknownProtos As Long '// datagrams with unknown protocol
  dwInDiscards As Long '// received datagrams discarded
  dwInDelivers As Long '// received datagrams delivered
  dwOutRequests As Long '//
  dwRoutingDiscards As Long '//
  dwOutDiscards As Long '// sent datagrams discarded
  dwOutNoRoutes As Long '// datagrams for which no route exists
  dwReasmTimeout As Long '// datagrams for which all
  dwReasmReqds As Long '// datagrams requiring reassembly
  dwReasmOks As Long '// successful reassemblies
  dwReasmFails As Long '// failed reassemblies
  dwFragOks As Long '// successful fragmentations
  dwFragFails As Long '// failed fragmentations
  dwFragCreates As Long '// datagrams fragmented
  dwNumIf As Long '// number of interfaces on computer
  dwNumAddr As Long '// number of IP address on computer
  dwNumRoutes As Long '// number of routes in routing table
End Type

 
Private Sub Timer1_Timer()
    UpdateStats
End Sub
 
Private Sub UpdateStats()

    Dim tStats          As MIB_TCPSTATS
    Dim lRetValue As Long

    lRetValue = GetIpStatistics(tStats)

  List1.Clear
  List1.AddItem "IP forwarding enabled or disabled: " & tStats.dwForwarding
  List1.AddItem "default time-to-live: " & tStats.dwDefaultTTL
  List1.AddItem "datagrams received: " & tStats.dwInReceives
  List1.AddItem "received header errors: " & tStats.dwInHdrErrors
  List1.AddItem "received address errors: " & tStats.dwInAddrErrors
  List1.AddItem "datagrams forwarded: " & tStats.dwForwDatagrams
  List1.AddItem "datagrams with unknown protocol: " & tStats.dwInUnknownProtos
  List1.AddItem "received datagrams discarded: " & tStats.dwInDiscards
  List1.AddItem "received datagrams delivered: " & tStats.dwInDelivers
  List1.AddItem tStats.dwOutRequests
  List1.AddItem tStats.dwRoutingDiscards
  List1.AddItem "sent datagrams discarded: " & tStats.dwOutDiscards
  List1.AddItem "datagrams for which no route exists: " & tStats.dwOutNoRoutes
  List1.AddItem "datagrams for which all: " & tStats.dwReasmTimeout
  List1.AddItem "datagrams requiring reassembly: " & tStats.dwReasmReqds
  List1.AddItem "successful reassemblies: " & tStats.dwReasmOks
  List1.AddItem "failed reassemblies: " & tStats.dwReasmFails
  List1.AddItem "successful fragmentations: " & tStats.dwFragOks
  List1.AddItem "failed fragmentations: " & tStats.dwFragFails
  List1.AddItem "datagrams fragmented: " & tStats.dwFragCreates
  List1.AddItem "number of interfaces on computer: " & tStats.dwNumIf
  List1.AddItem "number of IP address on computer: " & tStats.dwNumAddr
  List1.AddItem "number of routes in routing table: " & tStats.dwNumRoutes

End Sub

Ответить

Номер ответа: 18
Автор ответа:
 Makes



Вопросов: 8
Ответов: 36
 Профиль | | #18 Добавлено: 27.01.07 14:36
Неужели, больше не будет никаких преложений?

Ответить

Номер ответа: 19
Автор ответа:
 Makes



Вопросов: 8
Ответов: 36
 Профиль | | #19 Добавлено: 27.01.07 14:37
Например, мнение, Арсения, мне очень интересно.

Ответить

Номер ответа: 20
Автор ответа:
 Makes



Вопросов: 8
Ответов: 36
 Профиль | | #20 Добавлено: 04.02.07 13:46
Если нет готовых решений, то хотя бы подкиньте идею.

Ответить

Номер ответа: 21
Автор ответа:
 Sharp


Лидер форума

ICQ: 216865379 

Вопросов: 106
Ответов: 9979
 Web-сайт: sharpc.livejournal.com
 Профиль | | #21
Добавлено: 05.02.07 14:28
Посты 7 и 11

Ответить

Страница: 1 | 2 |

Поиск по форуму



© Copyright 2002-2011 VBNet.RU | Пишите нам