Library tutorials & articles
Client Server Programming with Winsock
Introduction
Winsock control comes with VB6 and is used to create applications that access the low-level functions of the Transmission Control Protocol/Internet Protocol (TCP/IP).
Most of you might have worked with Internet Transfer Control which is very handy control when it comes to Internet Programming but there is another control which even more robust and helps programmers creating more flexible applications. Winsock control comes with VB6 and is used to create applications that access the low-level functions of the Transmission Control Protocol/Internet Protocol (TCP/IP).
TCP/IP is a specification that defines a series of protocols used to standardize how computers exchange information with each other. TCP/IP provides communication across interconnected networks that use diverse hardware architectures and various operating systems. The protocols in TCP/IP are arranged in a series of layers known as a protocol stack. Each layer has its own functionality.
Winsock is a standard that is maintained by Microsoft. This standard is basically a set of routines that describe communications to and from the TCP/IP stack. These routines reside in a dynamic link library that runs under Windows. The winsock DLL is interfaced with TCP/IP and from there through the Internet.
In this article, I am going to show how to use the winsock in a client server environment, we will create two separate applications, one of which will be a server and the other will be a client. Both client and server will interact with each other to exchange data. Client will send a request to the server and the server which will be connected to a database will retrieve the information requested by the client from the database and will return the requested information back to the client. You will a database with this article, the database contains the item numbers and their prices. In real life situations, database might be located on a machine different from the one that hosts the client application.
Related articles
Related discussion
-
VB6 Runtime error 381 subsript out of range Error
by Uncle (2 replies)
-
passing and reading parameters from using Shell
by jigartoliya (0 replies)
-
Convert C++ code to VB6
by mawcot (4 replies)
-
listbox scrollbar
by Dennijr (10 replies)
-
Can you describe Above simple VB6 code?
by pramodmca09 (0 replies)
Related podcasts
-
Christian Beauclair
14 mai 2008 (�mission #0074) ::.Christian Beauclair: Stratégies de migration VB6 vers .NET Nous discutons avec Christian Beauclair des stratégies de migration VB6 vers .NET. Entre autres, nous discutons comment utiliser le "VB 6 Code Advisor" et le "Interop Forms Toolkit" pour ajouter la puiss...
you can check your answers here
hahahaa
Pls how can i see answers to the already posted messeges cos i hv similar problem/questions as hav bn posted
i want to know how to transfer images that are in the picture1.picture box from a client to another picture1.picture to the server using winsock control, anyone could help me out in this matter, also try to mail me... if anyone has the solution,
thanks
i want to transfere a file using C#
either ftp or winsock
if anyone knows how
please help
thank u
you can use the and OCX that is available in the web www.j7tech.com.
when you use the winsock senddata method, the data gets stored in the outgoing winsock buffer. you have to wait until the buffer is completely sent. If you call the senddata method again then the data in the buffer gets overwritten by the new data. To prevent this you use the winsock sendcomplete method.
For example:
Private Sub subSendInfo
' ...
'...
' pass the data to be sent to the winsock control
winsock1.senddata(data)
' now the send complete will execute when the buffer is empty
end sub
Private Sub winsock1_SendComplete()
' buffer empty now send more data
call subSendInfo
End Sub
how to send an image or a picture from the server to client using winsock?
good day...
i just want to ask how i can send files using winsock instead of using FTP in Internet Transfer Control?
thanks
maybe if u uses commands like what i want to learn but i had some source on how to make all that but lost it and never found it again but use the predefined commands
(in decloration or winsock.dataarive define each command)
winsock1.dataarive
if winsock1.dataarive then
+stats+ = 100
+name+ = name.text
+workgroup+ = 98
+ip+ = 0.0.0.0
select case TCPdata
case +name+ (notice i add a + in front and in back so that you can parish the data untill you get to + then use mid,right,left to get the data and store it into a string or something)
case +stats+
case +workgroup+
case +ip+
winsock1.senddata TCPdata
if anyone knows how to do something like this please i beg of you to help me out and get me started.
email=brianxmcd@aol.com
aim=microsofs
i need help with making a winsock multi chat that uses a list of commands to do diffrent stuff like add nickname to the list of users connected then if they want there age displayed a command that sends there name and age but single commands not multiple commands at once and maybe add chatrooms stuff like that. anyone have a tutorial about how to do this?
email = brianxmcd@aol.com aim = microsofs
thanks
I too have this same problem...... but i found that on the microsoft website if you download service pack 4, there is a fix for this issue....BUT!!!!!! this resolution only works if you run the application using the computer that you downloaded the service pack for....which does absolutely no good for me...so if anyone knows how to fix this let me know....
with several SendData one after another
does't work
i use DoEvents, but nothing
i readed that this problem
refers to the TCP/sliding window
in which way can i solve that
wiithout to use a "delay" between the sendDatas????
good day...
i just want to ask how i can send files using winsock instead of using FTP in Internet Transfer Control?
thanks
For i = 1 To iSockets
Msgbox(*)
Socket(i).SendData strOutData
Next
ohoh... use DoEvents
Guido
I based on your program try to develop a chatroom.
It is so strange that it cannot boradcast message in code like this:
For i = 1 To iSockets
Socket(i).SendData strOutData
Next
(only the last Socket can get the message , i.e. Socket(iSocket))
but can boradcast by this:
For i = 1 To iSockets
Msgbox()
Socket(i).SendData strOutData
Next
( = anything even empty)
(only Msgbox can do so)
Do you know what is the problem??
Thxxx
This thread is for discussions of Client Server Programming with Winsock.