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




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




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Simple FTP Sample Request
My objective is to send files to my FTP server via my VB App. I have tried K-FTP, ChilKat, and the Microsoft Internet Transfer Control without any luck, and because of the results I am going to blame it on me, God knows it works somewhere sometime.

So I am asking anyone for a simple solution to PUT file(s) from my chosen path on a defined directory on my FTP server. I know I will need to:

1) Connect to the server
2) Change Directory to were I want to PUT the files
3) Disconnect

Simple enough to me, until I try to do it. I was able to do the above using the K-FTP control but the files it PUT on the FTP server were 0 in size, and the source file did exist were I said it was.

Any help is very much appreciated.

Thanks,

John

Request For Sample Code For Datareport
hello,

after hours of straggling and de-bugging, can someone please write a sample code for how to create a data report and a data enviorment???

assume the sql string is:
"select field1,field2 from myTable"
database name: MyDB

i will be very very thankfull for any help

Request For Flexgrid Autoscrolling Sample Code
Anyone know a sample code on how to autoscroll the flexgrid before i'm about to leave the flexgrid while dragging an object?
I want to smooth scroll but the flexgrid scrollbars don't have all the properties of a normal scrollbar.

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 Sample
Hi Everybody,
I need a sample code to send and receive the data using winsock. please help me.

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)...??

Winsock : GET Http Gives Me Bad Request , Why?
guys,

is the statement below wrong??

GET http://www.hypermart.com HTTP/1.0


the dataarrival shows me error message...

400 BAD Request

can anyone justify this please?

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 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.

How Can You Request A Webpage Using Winsock And HTTPS?
HTTP is easy to form requests with using winsock..
but how can you make requests to a https site?

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

Viewing Cookies Sent With Either Winsock Or INet Request?
Hello,

Is there a way that I can send a request via INET (Most Likely), and read the cookies which were sent with that request?

Thanks

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....

Does Anyone Have An Example Of How To Send A POST Request With Winsock And A Proxy?
I know how GET works with winsock and a proxy, but how can you use a proxy and use POST?

anyone have an example?

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

Send A Sample Heirarchical FlexiGrid Sample With Dynamic Data
hi

Can any one send me a Heirarchical FlexiGrid Sample program with dynamic data or else with run time database connection and loading the data

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.

Can I Have Sample
Dear Friends


This mohamed ilyas 4m uae, i want some sample programes codes
iwant, combobox & listbox programes, if u have please help me
god bless you.

thanks and regards
ilyasjasi

SQL Sample
Looking for a SQL sample for WHERE clause that defines multiple columns...

strSQL = "select * from projectinfo"
strSQL = strSQL & " where requesttitle= '" & Combo2.Text & "'"
strSQL = strSQL & " where requestor= " & Combo3.Text & "'"
strSQL = strSQL & " where Priority= " & Combo4.Text & "'"
strSQL = strSQL & " where status= " & Combo5.Text & "'"
strSQL = strSQL & " where requesttype= " & Combo6.Text & "'"

This is what I got..but the SQL statements is picking up where as a column.

Sample
Hi,

i need some sample, how to input a checkbox into datagrid. I use VB 6 wiht Datagrid control to get a recordsed from MS SQL Server. i need to give a user posibility to check some rows, and then, i will make some action only for checked rows.

Have a somebody a idea, how to handle this problem?

Please....

Lp,DaT


COM Sample
does anyone have a ActiveX (COM) sample that written in C++ from scratch (not using MFC or ATL), which got some events, i.e. the component should implement IConnectionPointContainer, etc.

thanks.


HTH

cksiow
http://vblib.virtualave.net - share our codes

MMC Sample Help Please
I would like to use MMC snapins to be the administration program for the system i am developing. However I need to have a starting point somewhere.
Can anyone help.

I would like to have a root node for the application and be able to add new
configurations which appear as nodes under the main node.

1. I need to be able to popup a menu from the main node to add new nodes.
2. I need to be able to get an activex control (tabbed view) for each child
node.
3. The child node names are stored in the registry and can change in number
so I have to dynamically create these.

Can anyone give me a starting point?

I have downloaded the SDK and have installed Snapin into VB so I can get a
new snapin project.

I have successfully followed the instructions in MSDN to create a test one
"Creating a Simple Snap-in with an OCX Result View" but I can't seem to take
the next step.

When I tried the sample "Creating a Context Menu Extension Snap-in to
Display FileExplorer File Names" I could not find the item "lvExplorerFiles"
so I think I may not have the system installed correctly.

Can someone please help with a sample or 2 and how to install lvExplorerFiles.

thank you very much
DS

Where Do I Get Sample Projects?
Where do I get sample projects?

ACAD Sample Zip.
For those who asked here is a simple sample VB6 project dll that can be referenced from inside Autocad's VBA environment.

It Contains multiple VB6 forms and a global of the autocad.application object.
Hence in any of the VB6 forms you can access autocad methods and properties.

It also contains some sample clean up code.

Hope it illuminates,

P.S. Please note the class module property settings for future use.

~T

Need Tabstrip Sample
Hello, Can you help me if use Tabstrip Object why no easy ?

Because use Tabstrip, in design mode, is no easy see what tab!

Total: 4 Tabstrip:
tab1: object=Text1
tab2: object=Command1
tab3: object=Checkbox
tab4: object=List1

can you help me to make simple example about that tabstrip


AND if only use "tabstrip",
will show this error: Component "TABCTL3N.OCX" or one of its dependencies not correctly registered. (this error is used SSTab), how about tabstrip ?


a file is missing or invalid.


Please!

VBS Sample Prog.
hi guys! i have here my sample program in [VBS], but this program doesnt work properly... can you please help me:

Code:
<html>
<head>
<title>vince</title>
</head>
<script language="VBScript>

<!--
option explicit

sub add_onclick

dim x, y, z as double

x=tx1.value


y=tx2.value

z=cdbl(x)+cdbl(y)

call MsgBox "answer" & z

end sub

-->

</script>
</head>
<body>
<form>

<input name="tx1"
type="text">


<input name="tx2"
type="text">

<input name="add"
type="button"
value="click me">

</form>
</body>
</html>

Collection Sample
Hi there,

Can one of you guru's give me a straight sample of how to make a collection?
I want to use it to store translations for a program in it. Or is there a better way? I have all the translations for three languages in a database.

Please advice.

Regards

Jeroen.

Maybe A Sample Program Would Help?
I need to come up with something similar to this...Maybe if anyone will be willing to experiment and tell me the codes, I'll be very grateful

A VB6 To VB.NET Conversion Sample
Since this is a VB6 AND a VB.NET topic, I decided to post this here in VB6 land.

I created a relatively simple VB6 project for the express
purpose of seeing how easy it was to port it to VB.NET.

I wanted to:

. See how well the VB.NET upgrade wizard does.
. See WHAT the VB.NET upgrade wizard does.
. Show the VB.NET way of doing common VB6 things.
. Start with a simple, non-Database project, and
then add Database support to see what got added by
the wizard.

This project is a simple "Web password" application that
maintains a file of web sites, their login names, and
passwords. Sites can be added, deleted, changed or launched with a double-click. It uses enough VB6 functionality to give a good flavor of the conversion efforts.

I purposely kept this a small project.

Attached are the VB6 projects (2) and equivalent VB.NET projects.

Also included are my notes detailing the problems I encountered.

Even if you don't have VB.NET, you can examine the VB.NET files with a text editor to see how your common VB6 functions are now to be performed in VB.NET.

I couldn't attach the files here, so you can find the sample zip file at the following link:

http://people.ne.mediaone.net/benand...Net_sample.ZIP

Array Sample
Hi!

Because I couldn't post this one in the code library I'll put it here.

It's basicly a demo on using control arrays and arrays. Should be for begginers but someone could still find something usefull in it. The code is from my App (multiple mp3 player) and shows, how to work with control arrays.

Comments are welcome (please be gentle!)

XML && VB Sample Code?
Hello,

I am new to XML, but have loads of experience with VB. I need to learn XML and would like to get my hands on some sample code, where VB6 uses XML. Can anyone point me in the right direction? I tried the knowledge base but there was nothing useful there.

TIA

Help With Sample Application
Hello everybody, I'm new to the forum and new to VB.net.
I've begun teaching myself VB.net about 6 months ago and am looking to change careers(I'm currently in sales).
I've been told that nobody is going to hire me with no experience. I have one perspective employer that told me that if I can prove to him (by means of a sample application) that I can build my own app. from scratch, that he would give me an opportunity.
I have a couple of questions, the first one is: what do you guys advise for me to use as a sample app? Second questions is: What do employers typically look for in such an application?
Third: Is this typical, to be asked to prove what you can do via a sample app.

Any help would be greatly appreciated.

Sample Unbound ADO Example
Hello -- I'm in the process of writing an ADO database application in VB6
and seem to be having a few issues. I have Murach's Visual Basic 6 book.
This book presents things pretty well and makes it look relatively easy.
However, I feel like even the examples are not real-world enough to actually
implement. Granted, I've learned a few things about ADO, using MSFlexGrid
control, etc.

For example, I have a main form that lists a grid control. I would to have
the user right-click the grid control and have another form appear that
allows user to edit that particular row. What is the best way to use ADO
between multiple forms without writing an inefficient application that must
re-query the same data all over again?

I tried using global ADO connection object and global recordset objects for
anything that needs to be access by multiple forms.

The trick is, if another form has to edit the values, I have to make sure
the parent forms are refreshed with the new data.


My second issue is that I have a form that displays a list of records using
a listbox. When items in the listbox are selected, a frame to the right of
the listbox populates with the records detail (non-editable data). If the
user wishes to modify a record, I then have a button they press that loads
another form. The second form has a sstab control with various tabs for
modifying different parts of the record. I.E., customer name, address,
telephone, etc. Some of these items are in different tables....

Again, if items are updated on the second form (such as the name of the
customer), I need to make sure the parent form is refreshed and the list box
repopulated when control is returned. This seems very difficult.

I'm using ADO bookmarks and refresh and requery properties. Most of my
stuff appears to work; although it seems a bit kludgy and doesn't seem
structures or object oriented enough.

Any examples or pointers would be appreciated.

Ado Sample Project...
can anyone giv me a sample project or a tutorial on ado programming in vb6 that would add an entry in a database and can edit it....

pls anyone....

A Little Help Please. Sample Included
Im kinda stuck as to what to do here. Basically what I am trying to do is use the program below in conjunction with an access database to retrieve file information. The way it should work is to match up a persons account number and pin number and then return their account details. The variables for X and Y are the values of account and pin that would be used in the select statement for the sql but for some reason It doesnt seem like it wants to work correctly????????

CreateWindowEx Sample
Code:
Const WS_EX_STATICEDGE = &H20000
Const WS_EX_TRANSPARENT = &H20&
Const WS_CHILD = &H40000000
Const CW_USEDEFAULT = &H80000000
Const SW_NORMAL = 1
Private Type CREATESTRUCT
lpCreateParams As Long
hInstance As Long
hMenu As Long
hWndParent As Long
cy As Long
cx As Long
y As Long
x As Long
style As Long
lpszName As String
lpszClass As String
ExStyle As Long
End Type
Private Declare Function CreateWindowEx Lib "user32" Alias "CreateWindowExA" (ByVal dwExStyle As Long, ByVal lpClassName As String, ByVal lpWindowName As String, ByVal dwStyle As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hWndParent As Long, ByVal hMenu As Long, ByVal hInstance As Long, lpParam As Any) As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Private Declare Function DestroyWindow Lib "user32" (ByVal hwnd As Long) As Long
Dim mWnd As Long

Private Sub Form_Load()
Dim CS As CREATESTRUCT
'Create a new label
mWnd = CreateWindowEx(WS_EX_STATICEDGE Or WS_EX_TRANSPARENT, "STATIC", "Sample!!!", WS_CHILD, 0, 0, 300, 50, Me.hwnd, 0, App.hInstance, CS)
Me.Caption = mWnd
'Show our label
ShowWindow mWnd, SW_NORMAL
End Sub
Private Sub Form_Unload(Cancel As Integer)
'destroy our label
DestroyWindow mWnd
End Sub

GDI+ Documentation Or Sample
hi,

im trying to run an example by On Error:

http://www.xtremevbtalk.com/showthread.php?t=86403

i need to take either gifs or jpegs and make thumbnails from them.

I downloaded his program and the dll from MS. MS says to put the dll in the application directory. When i run the program i get the error message 'file not found: gdiplus'. Did regsvr32 thinking that might help, and got msg - dll loaded but no entry point found. Any ideas on why I am getting the 'file not found' error message? I am running WinME on my personal machine.

thanks.

GDI+ Documentation Or Sample
I am trying to use some APIs from the GDI+ but I can't find any documentation other than the MSDN which is written for the C programmers (which I cannot understand). In general I am interested in APIs that relate to image loading and saving. And at this moment I want to use the LoadImageFromFile API. I saw a sample code using this function but the sample loads the image into an Std Picture object which is too slow but I would like to load it into a Dib section and then bitblt the image on the form, which I assume should be much faster. Anybody have ideas for help.

Thanks

Sample Program
could someone kindly post a program to convert pngs to jpgs using the vbaccelerator or any other method?

ive looked at vbaccelerator loads and they seem to have too much info

Sample Code
Can someone or a few people please post some sample vb code from a .dll file that compiles properly. I am trying to create a dll, however I keep getting odd errors, so I first want to try compiling guaranteed code to see if it is my compilation method that is failing or the code I have written.... this is my first dll file.
Thanks in advance.

Sample Crossword?
I am working on a crossword, and I am almost done. There are just some things I can think of that could be done a better way...

If anyone could post links to any crossword generators (either in application or source code form, but of course I would prefer source code)

Thanks, and if anyone is interested I will show them the final product once I have completed it!

Sample Xml Code In Vb
hey, does anyone have some simple examples of vb code that

1) creates an xml document and writes something to it, and saves it somewhere

2) reads some xml document

or, if anyone knows anywhere on the net where i can find this information, i will greatly appreciate it.

thanks,

jeff

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