Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Winsock And Multi-Host Website, Where Is The Problem ?


Hi

I'm trying to make a program to work as an internet browser using winsock, I made some kind of success at the beginning with some famous sites (such as Yahoo!) but I failed to load some other sites, the server is replying with a page that tell me it is a multi-host website, while it can be opened normally using Internet Explorer, Where is the problem ? I'm using winsock command: "GET / HTTP1.1", but is there any other command can fix the problem ?

thanks




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Can I Host My WEBSITE With Iis W/Win XP After Reg. My .COM?
i just registered a .COM for myself and am thinking of purchasing win xp professional in order to use the IIS it comes with. After thats been done, what do i need to do to make my .COM work off my computer?

I heard that i would need a company to direct people to my IP address somehow... but i don't know of any.. any info on this matter..


-Nuno

How Do You Save A File So I Can Host It On A Website
i wanna host it on some forums so i can show my friends the cool game i made so how do you save coding to a file that the website will take?

Multi-port Host
I have a host that opens 4 ports. I want the client to try and connect to 10101 and if that is in use then try to connect to 10102 then 10103 and finally 10104. what would be the easiest way to do this. Also, how could i determine what client is sending in the Winsock_dataarrival event? Thanks

How To Select The Local Adapter On A Multi-interface Host
hi all,

I am using winsock API to create, bind, and use sockets (both UDP and TCP). When I am using a PC with one network card, or when I am connecting to the peer through the default network card on my laptop that has 2 cards (hard-wired and wireless), everything runs fins. Also when I communicate through the "other" network connection (the non-default one), it runs well whn I disable the default one. BUT:
When I try to send messages via the non-default network adapter while the default adapter is also enabled, the messages are routed to the default adapter. According to msdn, the bind() function of windosk can deal with this. So, I am trying to bind to the adapter I want to use, then send a message, but it still always goes to the default adapter. Here is the code (for the UDP socket):


************start code


Public Function NewSocket(ByVal AdrFamily As Long, ByVal SckType As Long, ByVal SckProtocol As Long, HWndForMsg As Long, Optional Source$) As Long
'********************************************************************************
'Purpose :Creates a new socket
'Returns :The socket handle if successful, otherwise - INVALID_SOCKET
'Arguments :AddressFamily, SocketType and SocketProtocol
'********************************************************************************
    On Error GoTo errHandler
    Dim hSocket As Long 'value returned by the socket API function
    Dim lngEvents As Long
    Dim socksrc As sockaddr_in

    'Call the socket Winsock API function in order create a new socket
    hSocket = socket(AdrFamily, SckType, SckProtocol)
    NewSocket = hSocket 'Assign returned value ( -1 => INVALID_SOCKET)

    If hSocket <> INVALID_SOCKET Then
        If Source$ <> "" Then
            socksrc = saZero
            socksrc.sin_family = AdrFamily
            socksrc.sin_addr = GetHostByNameAlias(Source$)
            If socksrc.sin_addr = INADDR_NONE Then
                NewSocket = INVALID_SOCKET
                If hSocket > 0 Then
                    Dummy = closesocket(hSocket)
                End If
                Exit Function
            End If
            If bind(hSocket, socksrc, LenB(socksrc)) = SOCKET_ERROR Then
                NewSocket = INVALID_SOCKET
                If hSocket > 0 Then
                    Dummy = closesocket(hSocket)
                End If
                Exit Function
            End If
        End If
        'The lngEvents variable contains a bitmask of events we are
        'going to catch with the window callback function.
        lngEvents = FD_CONNECT Or FD_READ Or FD_WRITE Or FD_CLOSE Or FD_ACCEPT
        '
        'Force the Winsock service to send the network event notifications
        'to the window which handle is p_lngWindowHandle.
        lngRetValue = WSAAsyncSelect(hSocket, HWndForMsg, WINSOCKMSG, lngEvents) 'Modified:04-MAR-2002
    End If
    Exit Function
errHandler:
    NewSocket = INVALID_SOCKET
End Function
 

**********end code

For TCP, I basically do the same: first socket(), then bind(), then connect(). According to http://msdn.microsoft.com/en-us/library/ms737550(VS.85).aspx this is the correct way to do it.

I am stuck...... any good ideas? Am I using the Bind() function wrong?

Winsock With Host... Is It Possible???
Hi
i know I can send packets to an IP address, but in a network with dinamic IP, how can I send messages to a computer??? how do I use winsock to do this????


Thanks

IP --&gt;&gt; Host Name, No Winsock
I have a list of IP addresses and need to get
the host names without the winsock for each.

Thanks

Winsock: No Route To Host
When I unplug the network cable the system pops up 'No Route To Host' and crashes the program. I am certain that they worked before the settings where changed for the network at my head office.

Anyone ever seen this before?

Winsock Remote Host Name
Hello,

Is there any possible way to determine the remote host name with winsock rather than sending a request strings back and forth to determine it?

Winsock And Local Host?
What settings should i use when I need to query a server on my local computer?

I'm writing a program to query a Battlefield 1942 server and I can get one over the internet just fine, but if I want to run my program on the same machine as the server, do I still use a winsock control?

I normally query the server as a UDP request on port 23000 on the internet. I've tried changing the ip address to 127.0.0.1 but I get a "Connection is Reset by Remote Side" error. The game server runs on port 14567 on my machine.

Any help would be greatly appreciated.

brandon

Get Host Name Without Winsock Control
How would i get the host name of the local machine without the winsock control?

UDP Packets And Winsock Host Ip - Please Help....
Im writing a small app that peeks intermittently at udp packets in order to log IP's that are connected to my port.

The idea is to ban ips that abuse the port, i just want to log them, so they can be added to a firewall


The problem is this, the port is in use by a game server, so i can only open the port for a tiny amount of time, otherwise the game server will crash..

I have a form with start/stop monitoring, alist (for the ips) and a few labels with 2text boxes for intput of port and local ip information in order to bind the socket.

Here is the code:


' udp port sniffer by mickle (C) 2002 Michael Williams

private Sub Command1_Click()
' toggle start/stop timer for capture
If Timer1.Enabled = true then Timer1.Enabled = false else Timer1.Enabled = true
End Sub

private Sub Form_Load()
' set my variables
txtLocalIp = "MY IP HERE"
txtLocalPort = "24711"
' set capture timer
Timer1.Interval = 1500
' set protocol
Winsock1.Protocol = sckUDPProtocol
' make sure socket is closed
Winsock1.Close
' make sure timer isnt firing
Timer1.Enabled = false
' log ips is on
addip = 1

handle = FreeFile
Open "packets.dat" for binary as handle
End Sub

private Sub Form_QueryUnload(Cancel as Integer, UnloadMode as Integer)
Close handle
End
End Sub

private Sub Form_Unload(Cancel as Integer)
Close handle
End
End Sub

private Sub Timer1_Timer()
Winsock1.Close ' make sure socket was previously closed (you know windows!!)
DoEvents ' dont freeze external programs
capture ' grab packet
End Sub

private Sub Winsock1_DataArrival(byval bytesTotal as Long)
x = x + 1
ReDim strincoming(0 to bytesTotal - 1) as Byte
'Winsock1.PeekData strincoming
Winsock1.PeekData strincoming
' update captions
Label1.Caption = CStr(bytesTotal)
Label2.Caption = CStr(x)
' close socket (make sure its closed to allow other program to use it)
Winsock1.Close
addipz ' add the ip from the host to the list
' write to file
Put #handle, , strincoming
End Sub

private Sub Winsock1_Error(byval Number as Integer, Description as string, byval Scode as Long, byval Source as string, byval HelpFile as string, byval HelpContext as Long, CancelDisplay as Boolean)
'ignore errors - i dont care for them
on error resume next
End Sub

private Sub capture()
' open the port and grab a packet
Winsock1.Bind txtLocalPort, txtLocalIp
DoEvents
End Sub

private Sub addipz()
Dim tmpstring as string
'Check if ip is in list
If List1.ListCount &gt; 0 then
for a = 0 to List1.ListCount
DoEvents
List1.ListIndex = a - 1
tmpstring = List1.Text
If tmpstring = CStr(Winsock1.RemoteHostIP) then addip = 0
If tmpstring &lt;&gt; CStr(Winsock1.RemoteHostIP) then addip = 1
next a
End If
' ok ip not in list so add it
If addip = 1 And List1.ListCount &gt;= 0 then
List1.AddItem CStr(Winsock1.RemoteHostIP)
End If
End Sub





What i need to know is why are the packets in my output file smaller than in a sniffers file?? and also the bytes are not the same, it seems as though a 16byte header is missing?? am i only getting the dat without the mac address and source ip??

I can log remotehostip as you can see, but am only getting 1 ip , even if there are a dozen connected....

i grab a packet at random on timer event, surely over a 1hr period i would grab one from someone elses ip???

My final intention isnt to output the packets to file, just the ips that have connected to the port..so any help as to why im only getting the 1 ip would be appreciated


thanks for any help or hints....it would be majorly appreciated

Using Winsock, How Do I Find Out The IP Of The Host That Is Connecting To The App?
Using winsock (UDP), how do I found out either the host name or ip address of the host connecting to my application?
Thanks,
- Gabe

CPU Load 100% Resolving Host With WinSock
When the WinsOck Control tries to resolve a hostname that does not exist, the CPU load jumps to 100% on Windows NT4/2000/XP systems. The state of the WinSock control is 6 (resolving).

First the status goes to 5 for a few seconds, then it takes about 3 seconds at a 100% load before an error occurs (10060 unable to resolve hostname).

How can I prevent this? When the application is running on a server, a CPU load of 100% is not affordable.

Thanks,
Jeroen.

Winsock Syntax? (To Request A Website With The Winsock Control)
Ok, I don't know very much about Winsock and am just now starting to use it. I'm making an anonymity program that modifies referer and user agent data. I managed to find an example of how its done on planetsourcecode.com but there's a few things that aren't working.

Anyway, when this string is sent, it sends the headers and a request for index.html from the connected host (winsock1.connect domain.com 80).

GET index.html HTTP/1.0
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, application/x-comet, */*
Accept-Language: en
Accept-Encoding: gzip , deflate
Cache-Control: no-cache
Proxy-Connection: Keep-Alive
User-Agent: Whatever
Referer: www.whatever.com

But when I used the website http://ipid.shat.net/ as the domain to see if code mdified the headers or not, it directed me instead to just www.shat.net. How would a browser request information to ipid.shat.net?

Also, I noticed that by sending just that information, cookies don't work properly. What other tags do I have to add onto that for it to recieve my session information? Thanks a lot.

Winsock Host Doesn't Broadcast To Clients
I WOULD REALLY APPRECIATE HELP WITH THIS! I'M RUNNING OUT OF IDEAS?

There is a closed application running on screen of the host. The host app written sends a CTRL "s" to this app in order for a file to written. The app then reads certain info in the file and broadcasts it to the clients which have connected to the host. The clients request a connection on port 8000 and are given 8001, 8002, 8003, etc, respectfully.

The problem I'm having is that the app runs in the school environment (where VB 6.0 is resident) and also on my teacher and my notebooks which are P4 centrino and mobile respectfully. Both the teachers and my notebooks have vb 6.0 installed. The app doesn't seem to run on site on the customers computers. I've tried different machines, AMD, P4, WIN 2K, XP PRO, XP Home and what happens is that the last machine that is connected is the only one that gets the info and the updates.

I just bought a brand new (virgin) P4 3.0 GIG to try after the weekend. I've been testing here and it seems to work, however there must be some file(s) missing as it takes up to 30 seconds for the updates to appear and yet if I click the mouse on the closed application (to toggle the focus) the info is immediately updated at the clients? I tried getting a few files from microsoft on the advice of a few friends like vbrun6.0sp3 and vbrun6.0sp5 and dotnetfx1 and dotnetfx2. These didn't make any difference the app still takes forever to send out and yet updates immediately with a mouse click on the host closed application?

Any ideas or direction is greatly appreciated?

Winsock Send Data To Remote Host In Activex Dll
Hi..

I need to send data to a remote host (in a certain port) by using winsock.. but I want to create the VB code in ActiveX dll because I need to call this function from ASP.. so, the client will only see the asp page only..

just say that the data I want to send is "1234567" to server "www.test.com" in port 4000.

Anybody can suggest a solution?

Thankssss

Winsock Send Data To Remote Host In Activex Dll
Hi..

I need to send data to a remote host (in a certain port) by using winsock.. but I want to create the VB code in ActiveX dll because I need to call this function from ASP.. so, the client will only see the asp page only..

just say that the data I want to send is "1234567" to server "www.test.com" in port 4000.

Anybody can suggest a solution?

Thankssss

Winsock To Connect 4 Players Include The Player Who Host The Game?
Help urgently needed...
i'm currently doing a project in my final year and i'm stuck with winsock..
can anyone please help me in winsock programming??? i need some references of source code which enable four players to connect to play a game of Bingo including the server who play the game as well ..
your help is highly appreciate by me ... thank you
please reply to johnson_yangsf@yahoo.co.uk if possible

How Can I Get Correct IP Address From Host Name Even If The Host Is In Hosts File?
Hi all,
Here is a code to get IP address from host name(pls add a textbox and a command control before run it), But if the host is in Hosts file it will only return the IP in Hosts file(C:WINDOWSsystem32driversetcHosts),

For Example, we test to get IP from www.mysql.com:
1. if there is no item "192.168.0.1 www.mysql.com" in Hosts file, it will retun 4 IP address:
213.136.52.29
213.136.52.82
213.115.162.29
213.115.162.82

2. if there is a item "192.168.0.1 www.mysql.com" in Hosts file, it will only retun the IP address in Hosts like:
192.168.0.1

But In fact I want to get the 4 address even if it is hosts file,
So how can I get the correct IP address from host name if it is in Hosts file?
Is there someone can help me? Thanks a lot!

Best Regards,
Robin


'Code: ===============================================

Private Const WS_VERSION_REQD = &H101
Private Const WS_VERSION_MAJOR = WS_VERSION_REQD &H100 And &HFF&
Private Const WS_VERSION_MINOR = WS_VERSION_REQD And &HFF&
Private Const MIN_SOCKETS_REQD = 1
Private Const SOCKET_ERROR = -1
Private Const WSADescription_Len = 256
Private Const WSASYS_Status_Len = 128
Private Type HOSTENT
hName As Long
hAliases As Long
hAddrType As Integer
hLength As Integer
hAddrList As Long
End Type
Private Type WSADATA
wversion As Integer
wHighVersion As Integer
szDescription(0 To WSADescription_Len) As Byte
szSystemStatus(0 To WSASYS_Status_Len) As Byte
iMaxSockets As Integer
iMaxUdpDg As Integer
lpszVendorInfo As Long
End Type
Private Declare Function WSAGetLastError Lib "WSOCK32.DLL" () As Long
Private Declare Function WSAStartup Lib "WSOCK32.DLL" (ByVal _
wVersionRequired As Integer, lpWSAData As WSADATA) As Long
Private Declare Function WSACleanup Lib "WSOCK32.DLL" () As Long
Private Declare Function gethostname Lib "WSOCK32.DLL" (ByVal hostname$, ByVal HostLen As Long) As Long
Private Declare Function gethostbyname Lib "WSOCK32.DLL" (ByVal hostname$) As Long
Private Declare Sub RtlMoveMemory Lib "KERNEL32" (hpvDest As Any, ByVal hpvSource&, ByVal cbCopy&)

Function hibyte(ByVal wParam As Integer)
hibyte = wParam &H100 And &HFF&
End Function

Function lobyte(ByVal wParam As Integer)
lobyte = wParam And &HFF&
End Function

Sub SocketsInitialize()
Dim WSAD As WSADATA
Dim iReturn As Integer
Dim sLowByte As String, sHighByte As String, sMsg As String
iReturn = WSAStartup(WS_VERSION_REQD, WSAD)
If iReturn <> 0 Then
MsgBox "Winsock.dll is not responding."
End
End If
If lobyte(WSAD.wversion) < WS_VERSION_MAJOR Or (lobyte(WSAD.wversion) = _
WS_VERSION_MAJOR And hibyte(WSAD.wversion) < WS_VERSION_MINOR) Then
sHighByte = Trim$(Str$(hibyte(WSAD.wversion)))
sLowByte = Trim$(Str$(lobyte(WSAD.wversion)))
sMsg = "Windows Sockets version " & sLowByte & "." & sHighByte
sMsg = sMsg & " is not supported by winsock.dll "
MsgBox sMsg
End
End If
'iMaxSockets is not used in winsock 2. So the following check is only
'necessary for winsock 1. If winsock 2 is requested,
'the following check can be skipped.
If WSAD.iMaxSockets < MIN_SOCKETS_REQD Then
sMsg = "This application requires a minimum of "
sMsg = sMsg & Trim$(Str$(MIN_SOCKETS_REQD)) & " supported sockets."
MsgBox sMsg
End
End If
End Sub

Sub SocketsCleanup()
Dim lReturn As Long
lReturn = WSACleanup()
If lReturn <> 0 Then
MsgBox "Socket error " & Trim$(Str$(lReturn)) & " occurred in Cleanup "
End
End If
End Sub

Sub Form_Load()
SocketsInitialize
End Sub

Private Sub Form_Unload(Cancel As Integer)
SocketsCleanup
End Sub
Private Sub Command1_click()
Dim hostname As String * 256
Dim hostent_addr As Long
Dim host As HOSTENT
Dim hostip_addr As Long
Dim temp_ip_address() As Byte
Dim i As Integer
Dim ip_address As String
hostname = Text1.Text & vbNullChar

hostent_addr = gethostbyname(hostname)
If hostent_addr = 0 Then
MsgBox "Winsock.dll is not responding."
Exit Sub
End If

RtlMoveMemory host, hostent_addr, LenB(host)
RtlMoveMemory hostip_addr, host.hAddrList, 4
'get all of the IP address if machine is multi-homed
Do
ReDim temp_ip_address(1 To host.hLength)
RtlMoveMemory temp_ip_address(1), hostip_addr, host.hLength
For i = 1 To host.hLength
ip_address = ip_address & temp_ip_address(i) & "."
Next
ip_address = Mid$(ip_address, 1, Len(ip_address) - 1)
MsgBox ip_address
ip_address = ""
host.hAddrList = host.hAddrList + LenB(host.hAddrList)
RtlMoveMemory hostip_addr, host.hAddrList, 4
Loop While (hostip_addr <> 0)

End Sub

How Can I Get Correct IP Address From Host Name Even If The Host Is In Hosts File?
Hi all,
Here is a code to get IP address from host name(pls add a textbox and a command control before run it), But if the host is in Hosts file it will only return the IP in Hosts file(C:WINDOWSsystem32driversetcHosts),

For Example, we test to get IP from www.mysql.com:
1. if there is no item "192.168.0.1 www.mysql.com" in Hosts file, it will retun 4 IP address:
213.136.52.29
213.136.52.82
213.115.162.29
213.115.162.82

2. if there is a item "192.168.0.1 www.mysql.com" in Hosts file, it will only retun the IP address in Hosts like:
192.168.0.1

But In fact I want to get the 4 address even if it is hosts file,
So How can I get the correct IP address from host name if it is in Hosts file?
Is there anyone can help me? Thanks a lot!

Best Regards,
Robin


'Code[color=Black]: ===============================================

Private Const WS_VERSION_REQD = &H101
Private Const WS_VERSION_MAJOR = WS_VERSION_REQD &H100 And &HFF&
Private Const WS_VERSION_MINOR = WS_VERSION_REQD And &HFF&
Private Const MIN_SOCKETS_REQD = 1
Private Const SOCKET_ERROR = -1
Private Const WSADescription_Len = 256
Private Const WSASYS_Status_Len = 128
Private Type HOSTENT
hName As Long
hAliases As Long
hAddrType As Integer
hLength As Integer
hAddrList As Long
End Type
Private Type WSADATA
wversion As Integer
wHighVersion As Integer
szDescription(0 To WSADescription_Len) As Byte
szSystemStatus(0 To WSASYS_Status_Len) As Byte
iMaxSockets As Integer
iMaxUdpDg As Integer
lpszVendorInfo As Long
End Type
Private Declare Function WSAGetLastError Lib "WSOCK32.DLL" () As Long
Private Declare Function WSAStartup Lib "WSOCK32.DLL" (ByVal _
wVersionRequired As Integer, lpWSAData As WSADATA) As Long
Private Declare Function WSACleanup Lib "WSOCK32.DLL" () As Long
Private Declare Function gethostname Lib "WSOCK32.DLL" (ByVal hostname$, ByVal HostLen As Long) As Long
Private Declare Function gethostbyname Lib "WSOCK32.DLL" (ByVal hostname$) As Long
Private Declare Sub RtlMoveMemory Lib "KERNEL32" (hpvDest As Any, ByVal hpvSource&, ByVal cbCopy&)
Function hibyte(ByVal wParam As Integer)
hibyte = wParam &H100 And &HFF&
End Function
Function lobyte(ByVal wParam As Integer)
lobyte = wParam And &HFF&
End Function
Sub SocketsInitialize()
Dim WSAD As WSADATA
Dim iReturn As Integer
Dim sLowByte As String, sHighByte As String, sMsg As String
iReturn = WSAStartup(WS_VERSION_REQD, WSAD)
If iReturn <> 0 Then
MsgBox "Winsock.dll is not responding."
End
End If
If lobyte(WSAD.wversion) < WS_VERSION_MAJOR Or (lobyte(WSAD.wversion) = _
WS_VERSION_MAJOR And hibyte(WSAD.wversion) < WS_VERSION_MINOR) Then
sHighByte = Trim$(Str$(hibyte(WSAD.wversion)))
sLowByte = Trim$(Str$(lobyte(WSAD.wversion)))
sMsg = "Windows Sockets version " & sLowByte & "." & sHighByte
sMsg = sMsg & " is not supported by winsock.dll "
MsgBox sMsg
End
End If
'iMaxSockets is not used in winsock 2. So the following check is only
'necessary for winsock 1. If winsock 2 is requested,
'the following check can be skipped.
If WSAD.iMaxSockets < MIN_SOCKETS_REQD Then
sMsg = "This application requires a minimum of "
sMsg = sMsg & Trim$(Str$(MIN_SOCKETS_REQD)) & " supported sockets."
MsgBox sMsg
End
End If
End Sub
Sub SocketsCleanup()
Dim lReturn As Long
lReturn = WSACleanup()
If lReturn <> 0 Then
MsgBox "Socket error " & Trim$(Str$(lReturn)) & " occurred in Cleanup "
End
End If
End Sub

Sub Form_Load()
SocketsInitialize
End Sub
Private Sub Form_Unload(Cancel As Integer)
SocketsCleanup
End Sub
Private Sub Command1_click()
Dim hostname As String * 256
Dim hostent_addr As Long
Dim host As HOSTENT
Dim hostip_addr As Long
Dim temp_ip_address() As Byte
Dim i As Integer
Dim ip_address As String
hostname = Text1.Text & vbNullChar

hostent_addr = gethostbyname(hostname)
If hostent_addr = 0 Then
MsgBox "Winsock.dll is not responding."
Exit Sub
End If

RtlMoveMemory host, hostent_addr, LenB(host)
RtlMoveMemory hostip_addr, host.hAddrList, 4
'get all of the IP address if machine is multi-homed
Do
ReDim temp_ip_address(1 To host.hLength)
RtlMoveMemory temp_ip_address(1), hostip_addr, host.hLength
For i = 1 To host.hLength
ip_address = ip_address & temp_ip_address(i) & "."
Next
ip_address = Mid$(ip_address, 1, Len(ip_address) - 1)
MsgBox ip_address
ip_address = ""
host.hAddrList = host.hAddrList + LenB(host.hAddrList)
RtlMoveMemory hostip_addr, host.hAddrList, 4
Loop While (hostip_addr <> 0)

End Sub

Winsock, Website Data
I have a scenario, where:

1. I can get the login information sent via get method in the url – But im not that keen on that because it shows up in history.

2. I can make VB enter the information into the website, but I am really clueless about winsock, any help would be helpful


Scenario 1 - I would like to know if it is possible to delete that certain url from history (Or even clear it all)

Scenario 2 – I really am unsure how to enter data into a online form (post)

But even after that I need to be able to read the html, then display certain parts of the information, I know in other information/scripts you are able to slect the line, then char that you want to read, I just cant seem to grab the html.

Any help would be useful.

Thanks.

(Winsock) Logging Into A Website
hey guys, im not really sure how to code this. how can i make a program login to this website? www.buzzen.com using winsock.

How To Know When Winsock Is Done Getting Data?[tcp-website]
Im connecting with a website and recieving data through the winsock control[TCP]. On my getdata, I will get sometimes 2-3 dataarival events because the winsock cannot fit as many chars as the website contains. Is there any way to know when the end of the website comes?

Check If Website Is Down Using Winsock
im making a program that visits a site using winsock. how would i know if the website im visiting is down using the winsock control?

Send Website Informations Via Winsock To Someone Else
I'm playing a massive-multiplayer-online-game. that means i have go online 5 times aday for about 3min. the game is programmed by a friend of mine. Now the computer-manager in school forced my friend to programm a IP lock, so we can't game from school.
I now want to programm 2 programms. a server and a client. the server would run 24/7 at my home PC and have to go and get the homepage and send the informations to the client. and the server has to click on a button in the website, but i want to say where to click, while working on the client.

How to get all the informations form the website, that I can send them with Winsock?

And how to make a click on the website at the server application, while sitting behind the client?

Just tell me how and what commands to use, I can try out and programming Winsock is no problem.

How Can We Determine The Sender Remote Host And SMTP Host (if The Sender Does Not Know His SMTP Host
How can We Determine the sender Remote host and SMTP Host (if the sender does not know his SMTP Host)

Loggin To A Website POST Method And DOM Or Inet Or Winsock HELP!!
Hi well what im trying to accomplish is succesfully load to a site that to login requires POST Method here's a little bit of the souce
-------------------------------------------------------------------------------
<form method="POST" action="membersarea.php">
<tr>
<td width="100%" colspan="2"><font color="#FFFFFF"><b><font size="1" face="Verdana">
EMAIL:</font></b><br>
<input type="text" size="17" name="email"></font></td>
</tr>
<tr>
<td width="100%" colspan="2"><font color="#FFFFFF"><b><font face="Verdana" size="1">
PASSWORD:</font></b><br>
<input type="password" size="17" name="password"></font></td>
</tr>
<tr>
<td width="100%" colspan="2">
<input type="checkbox" value="1" name="remember" CHECKED><font size="1"><b>Remember
Me</b></font>
</td>
</tr>
<tr>
<td><font size="1" face="Arial Narrow"><a href="lostpass.php">
Forgot Password?</a></font></td>
<td><input type="submit" value="Login" name="submit">
<input type="hidden" value="1" name="login_submit"></td>
</tr>
</form>
------------------------------------------------------------------------------

ok i need to login i have tried to do it with the DOM and this is what i got so far


VB Code:
Private Sub Command1_Click()With WB.Document.getElementById("email").Value = Text1.Text.getElementById("password").Value = Text2.Text.getElementById("remember").Value = "1".getElementById("submit").Value = "Login".getElementById("login_submit").Value = "1".Forms(0).Login.ClickEnd With End Sub Private Sub Form_Load()    WB.Navigate "http://www.domain.com"    Do While WB.ReadyState <> READYSTATE_COMPLETE        DoEvents    LoopEnd Sub


ok i get an error 'object doesnt support this method'
highlights this line

.Forms(0).Login.Click

anyway i can succesfully login to the page Thanks ALOT!!!

P.S. also there's anyway i can do it with INET control and winsock i would like to learn all of them 3 using POST method... thanks

regards,

EJ

How To Make Connection Host-client (client More Than 1) By Using Winsock
Dear all...
i have a problem about my connection....
i use winsock control to receive and transmit message
but it only can work if I only used 1 client (Host can display message
from the 1st client)
for example :
the IP of 1st clent is 107.102.29.11 and
the IP of 2nd Client is 107.102.29.12
and the IP of Host is 107.102.29.10
and the result : host only display message only from 1 client (can be 1st client or can be 2nd client; it depends on which client i start first)
can anyone give me the solution ...?
thanks before...

Winsock Multi Connections?
I'm just wondering what the best way for serving a multiplayer game in vb would be? Just use winsock as a control array? or is there some other way that might be better suited for the job?

Multi-Connections In Winsock
Hello, my problem is in my subject, i have read tutorials and i still dont get how to do it, please can some suppile me with a simple code that will accept more that one connect, and if possible comments because i will understand what is happening and wont bother you again lol
So can anyone help?

Thanks in advance!

Multi Winsock Problem
Hello,
here is my problem :

- I have 50 Winsock_User(Index) (so index is from 1 to 50), each sock receive 50 octet eache second. Everything is put into SQL DB and work just fine

- I have 1 Winsock_spy, and when i get a Winsock_User_Datarrival, i wait for my 50 octet, and then i send it to winsock_spy (with winsock_spy.senddata)

With only a few Winsock_User it's ok, but when all 50 send, in the same time 50 octet, the Winsock_spy doesent send anything, even if i put a breakpoint in the the winsock_spy.senddata and go step up... After 1 or 2 minute, if i stop all Winsock_User, the data of correctly send by Winsock_Spy after a while ...(1-2 minutes)


1) If i put "doevents" after the winsock_spy.senddata all i fine and work perfectly.
2) without the "doevents", if a "pause" the soft, and then "run" all start to be sent ....

You could say "doevents" is just fine so, but if i put more Winsock_Spy, for instance 50 spy, i got a "stack overflow" beacause of the doevents....


Any idea to helop me ???

Winsock Multi Connection
hey,

ive been searchin around the forum and some good websites i have found for a tutorial on how to make multiple connection with a winsock, say i have a server that any number of clients can connect to and when they send a text it pops up in a message box or something, the main point is i need to know how to make multiple connections, i have seen things such as


VB Code:
winsock(index) 'and also winsock(0)


please can someone explain this or give me a link to a goods tutorial
thanks

Winsock Multi Requests
hello. i finished creating s small lan chatroom using winsock. i wanna update the server to accept many requests which means for multi chat users. is there any too simple way to do it?
it will be great if u can add an attachment
thanks in advance

Winsock Multi Requests
hello. i finished creating a small lan chatroom using winsock. i wanna update the server to accept many requests which means for multi chat users. is there any simple way to do it?
it will be great if u can add an attachment
thanks in advance

Multi-ip Winsock Question
Hey, this is my first post here. i've searched and didn't find an answer to my question (which i usually do).

now, i've followed the winsock guides found in the CodeBank and they worked as they should work. my question is, how can i use winsock with more than one ip ? i'm building a game for 4 players, 1 of them is the server. so i wanna make the server connect to the other 3 players using the same port. do i need 3 winsock controllers working on the same port ? or can one winsock controller utilize (not sure if this is the right word) 3 connections?

any basic answer, example or a link are apreciated.

Winsock Multi Login
Why does this code

VB Code:
Private Sub Timer1_Timer() If WS1.State <> sckConnected Then       WS1.Close           WS1.RemoteHost = txtIpAddress.Text       WS1.Connect     Exit Sub End IfSB1.Panels(1).Text = "Connected to " & txtIpAddress.TextTimer1.Enabled = FalseEnd Sub

When it finnaly connects from a client have the Server log it in anything from 14 to 28 times
Does it store all the tries in a long string or what.

Winsock With Multi-users
sups,
I'm working on a lil chat program. I cant connect 2 remote users to the same server, so how can i make winsock to work with multi users?
tnx

Multi Winsock Transfers - PLZ HELP
Can anyone please give me some coding for multiple winsock file transfers? I have been looking around for one everywhere! Thank you

Multi - Connections Winsock
how can i implement a multi connection Server Using winsock?

can any one help?

thanks.

Winsock Multi-connection Problem
hi all
i have winsock server received data from another server. Then, the winsock server will process data(result) and find out which destination ip address to be sent to. Moreover, client winsock (winsock with a listen port) is not alwyas on. So, whenever i got the result and a destination ip addr,in my prog will use winsock.connect XX,xxx connect to the destination ip and sent data over. I have problem my state always 'connecting' even my client winsock is up and running ? Why ? OR did i need create array winsock ,,etc. PLEASE ADvise. Thanks in Advance

[
VB Code:
]For BbB = 1 To Val(strTotSeat)    If ArraySeat(BbB, 0) = strExt Then        Winsock2.Close        rHOSTIP = ArraySeat(BbB, 1)  'Destination IP Addr        rHOSTPort = "4040"        Winsock2.Connect rHOSTIP, rHOSTPort                Do Until Winsock2.State = sckConnected            DoEvents        Loop                If Winsock2.State = sckConnected Then            Winsock2.SendData strCustID & strPhone            Winsock2.Close            Exit Sub        Else            Winsock2.Close            'MsgBox "Remote Machine Connect Failed !"            List2.AddItem "Remote Machine Connect Failed:" & ArraySeat(BbB, 1)            Exit Sub        End If    Else       ' List1.AddItem "Destination IP Addr Not Found:" & strExt    End IfNext [
]

Thanks in advace !!!

Using Winsock In A Multi-user Environment.
I've got a fairly simple form with a "Send" button that sends the text in the form to a dedicated E-mail address via a Winsock control. The intent is to have this form on the desktop of several users on an NT server.
My question:
Is there any potential problems with more than one user trying to send data via Winsock at the same time?
Thanks,
Al.


------------------
A computer is a tool, not a toy.
<A HREF="mailto:asmith3914@aol.com
asmith@spxateg.com">asmith3914@aol.com
asmith@spxateg.com</A>

Winsock Is My Nightmare.... Send Multi Files.
I've only been doing Winsock for a short amount of time...
How do I go about sending out multiple files without confirmation? The files are just small .txt files (server logs) no more than 3k in size. I can send/receive one file no problem, but I can't figure out how to send all 3 of the one after another. Here's the code:

Code:
'On the Sending App
Private Sub SendFile(ByVal strFile As String)
Dim strSnd As String
Open "C:Summary.txt" For Binary Access Read As #1
Do While Not EOF(1)
strSnd = Space$(4096)
If LOF(1) - Loc(1) < 4096 Then
strSnd = Space$(LOF(1) - Loc(1))
Get #1, , strSnd
Winsock.SendData strSnd
GoTo conff
End If
Get #1, , strSnd
Winsock.SendData strSnd
DoEvents
Loop
conff:
Close #1
DoEvents
Winsock.Close
Winsock.Listen
End Sub

Code:
'On the Receiving App
Private Sub Winsock_DataArrival(ByVal bytesTotal As Long)
Dim dat As String

Winsock.GetData dat

If Dir$("C:RecData", vbDirectory) = "" Then
MkDir "C:RecData"
End If

Open "C:RecDataSummary.txt" For Binary Access Write As #1
Put #1, , dat
Close #1

If vbYes = MsgBox("Results are in! Would you like to view the data?", vbYesNo, "Results!") Then
Shell "notepad.exe C:RecDataSummary.txt", vbNormalFocus
End If
Winsock.Close
Winsock.LocalPort = 13245
Winsock.Listen

End Sub
I checked out EVERYTHING at winsockvb.com and even browsed their forums with no luck. Do I need to use packet delimiters or anything? Basically, I'm stuck.

Thanks!

Is Winsock Asynchrounous Multi Threaded By Default?
Hi

I read a post by a VB guru in some forum which says that Winsock control in VB 6 is an asynchrounous multi-threaded control by default.
Is it true!???
I don't know how to check if this statement is true or not so if you could please tell me about it then I would be grateful.

Multi-threaded Chat Server In VB 6 Using Winsock
I would like to have your opinion guys about the following situation.
I m trying to develope a messenger like Yahoo/MSN in VB 6 using Winsock. I am thinking about how the server should be made so
that it can cater to many users simultaneously.

Procedure will be as follows:

(a) A client requests login by sending userid and password to the server.
(b) The server checks it in the database and send the result TRUE or FALSE. TRUE means login correct and FALSE means login
incorrect.
(c) After receiving TRUE from server the client sends a message to the server asking to send the contact list.
(d) The server picks contact list from the database and sends it to the client.
(e) Client A sends a message to Client B which arrives at the server.
(f) The server then sends this message to Client B.

There could be many other features like adding a buddy in contact list, deleting him, blocking him e.t.c which I have ignored.

Now the techniques that I may use in developing the server are:


Technique 1
-----------------------

(1) I put a winsock control on a form listening on port 5000.
(2) This single winsock control will be used to login, sending message, loading contact list.
(3) The index property of this control would be 0.
(4) Every time a new connection requests arrive I load a new winsock control increasing the index by 1. For example


Code:
Private Sub serverSocket_ConnectionRequest(Index As Integer, ByVal requestID As Long)
If Index = 0 Then
lngConnectionNumber = lngConnectionNumber + 1

Load serverSocket(lngConnectionNumber)
serverSocket(lngConnectionNumber).LocalPort = 0
serverSocket(lngConnectionNumber).Accept requestID
End If
End Sub
(5) There will be seperate subroutines/functions for login, sending message and loading contact list.


Advantages of technique 1
------------------------------------------
(1) Easy to program.


Disadvantages of technique 1
----------------------------------------------
(1) I don't think it is a multi-threaded server or is it!?
(2) If a client request comes for login and the server is busy then if at the same time another requests comes from some other client to send a message then he will have to wait because server is busy with the login process.


Technique 2
-----------------------

(1) I put 3 different winsock controls on a single form.
(2) All the 3 controls will listen on 3 different ports which are 5000, 5001 and 5002 respectively.
(3) Each winsock control will be used for login, sending message and loading contacts respectively.
(4) The index property of each control will be 0.
(5) Every time a new connection requests arrive I load a new winsock control increasing the index by 1. For example


Code:
Private Sub LoginServer_ConnectionRequest(Index As Integer, ByVal requestID As Long)
If Index = 0 Then
lngLoginNumber = lngLoginNumber + 1

Load LoginServer(lngLoginNumber)
LoginServer(lngLoginNumber).LocalPort = 0
LoginServer(lngLoginNumber).Accept requestID
End If
End Sub

Private Sub MessageServer_ConnectionRequest(Index As Integer, ByVal requestID As Long)
If Index = 0 Then
lngMessageNumber = lngMessageNumber + 1

Load MessageServer(lngMessageNumber)
MessageServer(lngMessageNumber).LocalPort = 0
MessageServer(lngMessageNumber).Accept requestID
End If
End Sub

Private Sub ContactServer_ConnectionRequest(Index As Integer, ByVal requestID As Long)
If Index = 0 Then
lngContactNumber = lngContactNumber + 1

Load ContactServer(lngContactNumber)
ContactServer(lngContactNumber).LocalPort = 0
ContactServer(lngContactNumber).Accept requestID
End If
End Sub
(6) There will be seperate subroutines/functions for login, sending message and loading contact list. (and there are separete winsock controls also for these tasks remember).


Advantages of technique 2
------------------------------------------
(1) It may act like a multi threaded server.
Although here unlike technique 1 there are 3 different winsock controls for 3 different tasks even then I think the client will have to wait in case of two requests at the same time. Because even though controls are 3, the form is single so once loginserver is busy authenticating a client if another client sends a message he will have to wait because control cannot be transfered to SendMessage function as server is already busy in Login. What do you guys say!?


Disadvantages of technique 2
----------------------------------------------
(1) A little difficult to program.



Technique 3
--------------------

(1) I put 3 different winsock controls on 3 different forms. (each control on each form)
(2) All the 3 controls will listen on 3 different ports which are 5000, 5001 and 5002 respectively.
(3) Each winsock control will be used for login, sending message and loading contacts respectively.
(4) The index property of each control will be 0.
(5) Every time a new connection requests arrive I load a new winsock control increasing the index by 1 same as technique 2.
(6) There will be seperate subroutines/functions for login, sending message and loading contact list. (and there are separete winsock controls also on 3 separate form remember).


Advantages of technique 3
------------------------------------------
(1) It may be truly a multi-threaded server. (not sure)
Because now there are three separate controls on three separate forms. So if a client send request for Login and another
client sends a message then the server will not remain busy with Login as it is on different form with different control. In this way both Login and SendingMessage will work simulatneously.


Disadvantages of technique 3
---------------------------------------------
(1) Very difficult to program.
(2) I don't think it is logicalyl correct to use this technique or is it!? The server should be one which will have mulitple threads instead of using three different servers (winsock controls). Isn't it!?


Please give me your comments on the techniques above. As I said earlier my goal is to make a multi-threaded server so if you
think that none of the above is a multi-threaded server and you have a better idea then please tell me.

Small Winsock Multi Connection Prob
i have created a winsock server in vb, but i cannot seem to get the chat aspect of it working. the computers connect to the server fine, but the messages they send off the 'client' programs never gets displayed. there is no problem with the clients programs, i have tested them on other TCP/IP programs and they work fine. here is the code i am using on the server.

Private Sub Winsock_DataArrival(ByVal bytesTotal As Long)

Dim strData As String
' get the data and display it in the textbox
Winsock.GetData strData
txtMain.Text = strData
MsgBox strData

End Sub


aparently, it doesnt match the description of the event or procedure having the same name??

Winsock Server Multi-User Question
I'm have a basic question on the Sock_DataArrival. When the data comes in, I have to pass the incoming SQL request to the DB connection, reformat the returned data, then push it back out to the connection (sock(x)) making the request. The process works fine, but now that I have 5 connections bashing the server, it appears that the requests are stepping on each other. Some of the requests can be extremely large, up to 5000 records, however most are short but frequent. I'm thinking of creating an array of timers, then passing each request to the appropriate timer for processing since each connection will wait until I send a reply....help!

Private Sub Sock_DataArrival(Index As Integer, ByVal bytesTotal As Long)


Sock(Index).GetData strDataIn

SockData(Index) = SockData(Index) & strDataIn

If InStr(SockData(Index), "~") Then 'end of message character

'**** Process The SQL Request,
'**** this gets data from the DB
'**** connection, reformats the data,
'**** then sends it out.

Sock(Index).SendData strReply

SockData(Index)= ""
strReply = ""

End If

End Sub

URGENT HELP NEEDED... Multi Winsock Messenger
I have a basic IP server and client made. Multi clients can connect. I am using two winsock controls. They are seperate files.

I would now like my clients 'Nickname' and their 'IP' to be sent to the server to go into a listbox. I would then like this listbox to be sent to each client so that they can Private Message each other.

Please Help Me! :-)

THANX

Winsock Multi High Speed Connections
I've ran out of ideas without getting elaborate in the sending/verifying. Maybe I am missing something easy...

One server. Loads a new instance of the winsock control with a new connection - similar to the help examples...

Each client has a single winsock control successfully connecting and transmitting to the server.

The server then retransmits the data back out to all the other connected clients.

Works ok, but at 4 transmits a second of 2k of data, the "slow" connection clients sometimes get a send complete event however the data does not always get back out to the other clients (such as one of my wireless PC's vs a couple wired ones).

I'm not sure how to efficiently deal with this. If I made the clients wait until the data is retransmitted, a slow connection will bog everyone down. If I stored the data to be sent for slower connection PC's, I will lose something unpredictable.

My next thought would to be to divide up the data into small groups of data and send those that are critical or has actually changed since the last transmit - but I don't know if I spent the time if this would help. Sending one bit of data may not be much different than sending 100 bytes due to overhead... 100 bytes may not be any different that 2k... don't know. 2k doesn't sound like much, but it might be. Say 4 clients, 16,000 bits ea, that's 128kb a second??? Doubling it for the server resending .... er wait, that's exponential for each client... I think I see my problem... maybe...

Thanks for any advice or pointers in high speed multi-clients...

Copyright © 2005-08 www.BigResource.com, All rights reserved