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.
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Winsock Request
I have a Winsock component setup right now on my network, exact same as whats in this thread
I would like to know if a similar control can be built using Winsock to do this:
1) Connect to a remote computer, by IP address. (I have a code that determines the IP address of the remote machine already..)
2) Open a .txt file, send it back to (my) the users computer and displays it in a text box on screen.
3) On command button press, take what ever is in my text box, and send the file back to the remote computer and save it.
Kind of like editing a configuration file, remotly.
I know the application would have to be running on the remote end as well as my end for this to work, if its at all possible.
I would really like to do this, I appeciate everyones help in advance!
Winsock Example Request
I'm at work where I can't get to any help files for winsock. Can somebody give me a quick example of the code required to create a winsock instance, including telling it to listen and respont to internet requests? I'm going to attempt to make MS Access act like a simple server, and I just don't have the resources here to get it running. Thanks!
Winsock HTTP Request Help
I need help with this, my wrapper uses winsock to send requests and the close event does not fire which makes the connection stay open forever, my wrapper is at the bottom it is a attachment
WinSock Request Accept
Hey,
I have been trying to get this code to work, It's most likely something stupid am doing, but i cant get my server program type thingie to accept the Request ID from the client program thingie... Here is the code to the part that it says is wrong (If you need anyother parts tell me an i'll post it)
Code:
Private Sub HostSocket_ConnectionRequest(ByVal requestID As Long)
'Show Request In Host Log
HMsg = "Connection request id " & requestID & " from " & HostSocket.RemoteHostIP
HostLog.AddItem (HMsg)
sRequestID = requestID
iSockets = iSockets + 1
ConNumber.Caption = iSockets
Load HostSocket(iSockets)
HostSocket.LocalPort = 1007
HostSocket.Accept requestID
End Sub
PS. I looked at an example to help me with this, so am not sure whats wrong.
Thx in advance.
Ali.
Can Winsock DLL Do Other Protocol Request ...
guys,
i find that the winsock OCX really is limited in its capability...
can anyone suggest me a better one for network programming? because the protocol type is limited to a few only....
I hope to do RTSP / RTP request ... is there any thing that i can used to do that ???
can Winsock Dll do other protocol request or its the total same with the winsock OCX?
Does anyone has a sample using winsock DLL (as client)...??
Multiple Request With Winsock
Greeting,
I have a little problem with winsock. I have a server and several
client. I want to transfer text from server to client trough the network
In this case, I using winsock to transfer the text. It is ok when only 2
computer connected (1 server and 1 client). But, when 3 computer
Connected (1 server and 2 client) I cant broadcast text to all client.
Does any body know how to broadcast text fom server to client trough the
network and winsock?
thanks
Rgds,
Rano Nugrah Agung Homan
Winsock Sample Request
Hi all,
I need to make a server app for my project. I have concluded that I will need to implement Winsock to do so. I have read up on all Winsock articles here (and many others elsewhere) and have downloaded and studied all the samples I could find.
However, I am unable to do what I want because:
- The tutorials say that the IP address or friendly name of the target computer MUST be specified for the Winsock control to connect on the other side. This strikes me as very backward, as I can not always know what IP addresses my customers' network stations will be running on and cannot also predict their friendly names. Does this have to be hard-coded?
- Try as I may, I cannot create a working sample of Server.Exe and Client.Exe to run on the same machine as I cannot afford the luxury of testing my code over two machines. Is there any way I can debug / test on one machine?
If any member proficient with Winsock (Laura Stephens and Jason Rogers come to mind) would like to help, I shall appreciate a small sample to get me started by solving the above two problems.
GoodGuy
Experience is a bad teacher for its exams precede its lessons.
Edited by - GoodGuy on 12/10/2007 10:23:30 PM
Winsock Array Connection Request
i made a post a couple days back gavino answered
im trying to make my multi chat program and well, it isnt goin by too well. for starters the client cant connect
Code:
Private Sub sckSocket_ConnectionRequest(Index As Integer, ByVal requestID As Long)
SockNum = SockNum + 1
Load sckSocket(SockNum)
sckSocket(SockNum).Listen
sckSocket(SockNum).Accept requestID
End Sub
is there sumthing wrong with that?
[VB6] Winsock POST Request Problem
I'm trying to connecto to google.com and translate a simple word (just to test if works).
And I have a problem when I'm sending POST request data, here is my code:
Code:
Private Sub Command1_Click()
Winsock1.Close
Winsock1.Connect "www.google.com", "80"
End Sub
Private Sub Winsock1_Connect()
Dim packet As String
Dim strpost As String
strpost = "hl=it&ie=UTF8&text=hello&sl=en&sl=en&tl=it&tl=it"
packet = "POST /translate_t HTTP/1.1" & vbCrLf
packet = packet & "Host: www.google.com" & vbCrLf
packet = packet & "Accept: */*" & vbCrLf
packet = packet & "Accept-Language: it,it-it;q=0.8,en;q=0.5,en-us;q=0.3" & vbCrLf & vbCrLf
packet = packet & "Content-Type: " & "application/x-www-form-urlencoded" & vbCrLf
packet = packet & "Content-Length: " & Len(strpost) & vbCrLf
packet = packet & strpost
Winsock1.SendData packet
Text1.Text = Text1.Text & packet
End Sub
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim data As String
Winsock1.GetData data
Text2.Text = Text2.Text & data & vbCrLf
End Sub
As you can see I want the GETDATA in Text2.Text but I recieve this error:
Code:
HTTP/1.1 411 Length Required
Date: Fri, 01 Aug 2008 13:57:24 GMT
Content-Type: text/html; charset=UTF-8
Server: GFE/1.3
Content-Length: 1357
{html code}
What's the problem?!
Thanks in advance.
WinSock Connection Request Error!
When I use this code for a winsock connection request:
Code:
Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
Winsock1.Accept requestID
txtRecive.Text = txtRecive.Text & vbCrLf & "ChatX: Connection Request Detected."
End Sub
I get runtime error 40020:
Invalid operation at current state
when I hit debug it highlights that code snippet up there! HELP
Winsock Server Connection Request Problem
hey, this is my code
Code:
Private Sub wskServer_ConnectionRequest(ByVal requestID As Long)
Dim msgboxResult
msgboxResult = MsgBox("A connect request has been initiated by: " & wskServer.RemoteHostIP & vbNewLine & "Would you like to accept it?", vbYesNo, "Connection Request")
If msgboxResult = vbYes Then
wskServer.Accept requestID
isServer = True
End If
End Sub
now the problem is, whenever i run it, and have a client try to connect to it, this is the error the server gives me on this line "wskServer.Accept requestID"
---------------------------
Project1
---------------------------
Run-time error '40020':
Invalid operation at current state
---------------------------
OK
---------------------------
can someone help?
EDIT: and yes, i did try:
wskServer.Close
wskServer.Accept requestID
but it doesn't work. if u need 2 see my whole code to know whats going on, just let me know
Winsock/cookie Request Entity Too Large...
hi i'm sending a cookie header via winsock but i think it's to large cause I'm receiving a "Request Entity Too Large" in the HTTP Response. is there a way around this?
Winsock - Notification When User Accepts Request
Does anyone know of a way that an initiator of a Winsock connection can be notified when a user on the other end accepts the connection ? I'm new to Winsock, so my terminology might not be the best, but I'm trying to find out if the inititator has any way of knowing that a connection was made before any messages are exchanged?
Thanks for any help....
HELP: Winsock To Send HTTP POST REQUEST To A Machine
Hello,
I would like to use visual basic to send data to a machine using an HTTP Post request, and cannot decide on the best way to do it. Can I use winsock. Please bear in mind the following.
I am sending a mult-part message (kind of like an email with attachments). It's actually a multimedia message in the MM7 format -> this is similar to email, a multipart MIME message.
I MUST post to a destination using the following format:
http://192.168.3.75:2097/mm7
I need to then send the data which I've formated according to the MM7 spec.
I need to receive responses from the receving application.
Any help would be greatly appreciated.
Thanks
Ben
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.
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?
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.
WINSOCK CONTROL Vs WINSOCK REFERENCE
Why with a Winsock refernce events don't work and with a Winsock control events work?
"public withevents MySock as winsock". With this declaration, I can't use events (like connectionrequest ecc.).
With a WinSock control I can use events. WHY????
Winsock API Webserver (not Winsock Control)
Hi,
I'm trying to do a winsock webserver, that can handle lots of connections at once.
each new connection request creates a new instance of the winsock control
ie load winsock(1).....etc
it needs to be able to handle 200 users but it looses connection requests every so often and so some people cant connect I think this is because the winsock control cant handle so many connections at once. Would coding using the WIN API be better (quicker)???
Thanks
Paul
Flushing In Winsock Control And Winsock API
I used to work in Java Sockets previously and there I have been using flush method of the associated stream with Socket class to make sure that the data I sent using Sockets is successfully sent; simple to flush the Socket.
But, here in Vb I can find any function or method fulfilling the same purpose. Can anyone give me some idea about how to do it with Winsock Control or Winsock API?
Normally winsock works quiet well but in my previous project I faced a related problem about transmitting data. Therefore, while using it for the second time, I am a concious about it and working on the solution to the 'data delay' problem before working on the actual system.
thanx
Winsock Syntax
I am working on a VB 6 app that will communicate with a third party server control. The server control wants inforamtion posted to it in the following format.
http://SQL200:1000/cgi-bin/auth.cgi?ya_da_ya_da_ya
sql2000 = local server's name
"ya_da_ya_da_ya" = information to be posted.
I have used the VB winsock control in my app to connect to the server and send the information.
Winsock1.Protocol = sckTCPProtocol
Winsock1.Connect "10.0.0.113", "1000"
Winsock1.SendData "ya_da_ya_da_ya"
I have confirmed these three lines of code successfully connect to the server app and send the information. However, since I did not incluce the location of "cgi-bin/auth.cgi", the server does not reply.
How do I connect to the location "cgi-bin/auth.cgi"?
I have tried numerous combinations but they are all just guesses. I do not know how or where to put the "cgi-bin/auth.cgi" in the connect statement.
When I open a browser on the sql2000 machine and type in:
http://localhost:1000/cgi-bin/auth.cgi?ya_da_ya_da_ya, the server responds with the correct information.
I am trying to create a winsock control that that sends this data and listens for the response.
Thanks,
pat
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
Using A Seperator With Winsock (syntax)
Hi all, im curious to know how i can accomplish something like this...
winsock1 sends data with 4 seperate items. (item1|item2|item3|item4)
how can i setup a way to seperate them like that
winsock2 (server) received the data string and pulles the items apart. and puts them where they need to be. and sends the result back to the clients.
Thanks
Winsock, Syntax Error...
I'm trying to connect to a ftp server with the winsock control.
I have setup the winsock controls remote hsot and port.
The data arrival event puts the data recived in a text box.
I see that the ftp server wants the username.
I have another text box where I can enter commands to send with the senddata method of the winsock control. But when I try to send the Username to the ftp server, all I get back is "500 Syntax error, Command not recognized".
I have tried to use USER *****, and only ******. I also have tried to add vbcrlf after the string to be sent. I have tried to add vbcrlf before the string to be sent...
What are I doing wrong???
/Smirre
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
Winsock.remotehost Syntax Problem
hi
I have had Winsock going before , but now I can seem to enter the
.RemoteHost name properly
What is the format for the name?
ie. username.ispname.co.nz
username@ispname.co.nz or what?
I get error # 11004 when I do a .Connect , indicating the host was not found.
(I have a ADSL connection made (email program works).)
I have tried to connect using 'open' command in TelNet in DOS,
but same result.
Winsock API Vs. Winsock Control
Hi there, well i was wondering, what are your thoughts on the pros and cons to using the API over the control, or the Control over the API's, i understand the API require alot more code, so don't say use the control becuase its easier, but i am curious as to hear which would be more proficient for a program that is going to communicate with a remote FTP.
Now i am not sure if features are different in the control and APIs but a fwe things i was wondering are, is it possible to check the file size of a remote file on an FTP using winsock, i have been using the wininet API's but i am getting error 12003 from alot of the people using the program, why i have no idea, but its there, so i thought to try winsock to see if it solves it.
Using the winsock apis i was able to do a remote file size check, but i have searched the boards and can't find any code that would help me to see what the remote file size is.
Now for the real question.
I have read that alot of programs out there use code that checks a remote file to a local file byte by byte and if there is a difference between two bytes it updates ONLY that byte, my question, is there anyway to read a file remotly without downloading it? becuase i am not sure how they do this byte by byte thing, <shrug> anyway i was just curious really what you use, the WS control or the API. Thanks Much =)
Winsock API Vs. Winsock Control
What advantage is there to useing the winsock api instead of the winsock control, is there one? or does it just make it exponentially more complicated
Winsock Without Winsock Control
Is there a way that I can communicate with another computer on the network (already running my server app) without creating a form with a winsock control? I am trying to write a command line only app that needs to transmit a string to the server. (I the only time I have ever done this was when I used the Winsock control.) Maybe an API call or something like that?
Also, how can I write output back to the DOS window. For example you can type DIR /? at the command line and you get a listing of the available options as well as a some help with using the DIR command. I would like my program to have this ability.
Any help would be greatly appriciated!
Thanks
Winsock State 8 - Peer Closes The Connection Leaving Winsock High And Dry
I am debugging some web/proxy-serving code. I am stumped.
I get Winsock state 8 - Peer is closing the connection
Then Winsock error message wrong protocol or connection state.
It seems to me that Winsock closes before it can finish sending all of its data.
How can I keep Winsock in state 7 - Connected?
Thanks...
Winsock Error (System Lockup Upon Winsock Execution)
Has anyone encountered an issue when running the winsock command and either a .listen or .connect locks up your VB Studio? This is occurring on my system and I'm not sure if its a problem with my current DLL or if I'm just not doing something correctly.
Please help.
Chris, Baltimore.
Winsock - Send PictureBox Contents Thrue Winsock?
Hey all, is it possible to send the contents of a PictureBox thrue a Winsock?
I know i can save the contents first to file and then send as file, but wondering this is possible, the purpose is in my chat project i have a webcam capture feature wich works fine, but i can't figure out how i can send this stream, did some searches but not found any results about it.
=============================================
aka Red2048.
Urgent:request And Download A File From A Website
Hi,
I have developed a VB6 application.All i want is when the user clicks a Command button a request should be be sent to my website and a file should be downloaded from the website to my application folder.Can anybody tell me how to achieve this.Thanks
Very Frustrating Winsock Bug.. Winsock Stops Responding After A While.
I have about 100 winsocks in an array handling a bunch of tasks.
The program seems to work fine for a while, but then for no reason, winsock stops responding. I can receive and send thosuands of packets before this happens but when the bug occurs it is extremely frustrating.
Winsock seems to die completely. DataArrival never fires, I cant make new connections (Always stuck on 'Connecting..'), its a mess. Closing the program and reopening it does not solve the problem - I have to close VB6 entirely and reopen it for the application to work again.
Has anyone dealt with something like this in the past?
I have no idea whats wrong
Winsock Error <winsock.getdata Strdata
Hi
I am using winsock control named tcpclient in my application.
When i call the statement as
tcpclient.getdata strdata
It raises an error showing as
Runtime Error : "10054"
The connection is reset by remote side
I don know why this error is coming pls help me if uve any idea
Thanx
Will Winsock Get Timedout? Can Do Login On Winsock.connect?
Hi all,
Just wondering, let say I connect to a server using Winsock and leave the connection open... does Winsock timeout or close that connection? If yes, how long winsock give before it timeout/close the connection?
Is it possible to do a login on winsock.connect; ie: winsock.connect userid, pwd? I'm thinking if possible everytime i connect, i pass the userid and pwd to the server for validation... if all correct than accept the connection else reject... is this possible?
Thank You
Regards
Winsock Connection Prob: &"Request To Connection Time Out&".
Hi All,
I am developing chat application like Yahoo and MSN messenger. Also i have almost completed it. I have two applications one is server appliation which will be run on chat server machine. the other is client appliation which will be used at any corner of the world.
Its working fine on my network. Ya, it is also working fine over network but with some misbehaviour. Sometimesm, it allow someone to login and sometimes it doesn't and gives "Request to connection time out" error.. I can't find the reason y it is happening.
I have developed this in visual basic and used winsock control.
Winsock Control
hi, could anyone help me on creating program that could control,view users,and could know the time they have been logged on the internet on LAN?
Can Someone Please Help Me? {Winsock Control}
I have VB 6.0 learning edition and dont have the winsock control. If I purchase visualbasic.net will it have the winsock control?
It is listed as Microsoft Internet Control in the components list
Help With Winsock Control In Vb 6.0
so i am trying to make an application that more then one person will be connecting to using the winsock control, i was wondering if i needed more then more winsock control, or is there a way to do it with one??
|