VB code
Dim lResult As Long
Dim bufSize As Long
bufSize = CLng(1024) * 1024
lResult = setsockopt(Winsock1.SocketHandle, SOL_SOCKET, SO_RCVBUF, bufSize, 4)
If (lResult = SOCKET_ERROR) Then
MsgBox "Error setting SO_RCVBUF option: " & CStr(Err.LastDllError)
End If
lResult = setsockopt(Winsock1.SocketHandle, SOL_SOCKET, SO_SNDBUF, bufSize, 4)
If (lResult = SOCKET_ERROR) Then
MsgBox "Error setting SO_SNDBUF option: " & CStr(Err.LastDllError)
End If
bufSize = 0
lResult = getsockopt(Winsock1.SocketHandle, SOL_SOCKET, SO_RCVBUF, bufSize, 4)
If (lResult = SOCKET_ERROR) Then
MsgBox "Error getting SO_RCVBUF option: " & CStr(Err.LastDllError)
End If
'bufSize=1024*1024,说明设置成功