Library tutorials & articles
Client Server Programming with Winsock
- Introduction
- Ports & the WinSock Control
- WinSock Properties & Events
- Creating the Client
- Creating the Server
Ports & the WinSock Control
I think it would be better to talk about the ports before we proceed any further. A port is a special memory location that exists when two computers are in communication via TCP/IP. Applications use a port number as an identifier to other computers, both the sending and receiving computers use this port to exchange data.
To make the job of communication easier, some port numbers have been standardized. These standard port numbers have no inherent value other than that users have agreed to use them with certain applications. Table below lists a number of popular and publicly accepted port numbers and their corresponding applications.
| Service | Port |
| HTTP | 80 |
| FTP | 20,21 |
| Gopher | 70 |
| SMTP | 25 |
| POP3 | 110 |
| Telnet | 23 |
| Finger | 79 |
| Local loops/callbacks | 0 |
Using the Winsock Control
Winsock is above the TCP/IP protocol stack in the ISO/OSI model. TCP/IP is an industry standard communication protocol that defines methods for packaging data into packets for transmission between computing devices on a heterogeneous network. TCP/IP is the standard for data transmission over networks, including the Internet. TCP establishes a connection for data transmission and IP defines the method for sending data packets.
The Microsoft Winsock control makes using the TCP/IP a breeze. Microsoft has wrapped up the Winsock and INetAPI API calls into a nice neat package that you can easily incorporate into your Visual Basic applications.
Winsock Operating Modes
The Transport layer (also known as the Host-to-Host Transport layer) is responsible for providing the Application layer with session and datagram communication services. The core protocols of the Transport layer are TCP and User Datagram Protocol (UDP). The Winsock control supports the following two operating modes:
- sckTCPProtocol
- sckUDPProtocol
Related articles
Related discussion
-
Run-time error '91'
by crazyidane (0 replies)
-
Problem handling Redirects with MSXML2.XMLHTTP
by brandoncampbell (2 replies)
-
vbinputbox pauses code while it waits on response. How can I reproduce that?
by brandoncampbell (1 replies)
-
Sending SMS in VB 6
by sirobnole (6 replies)
-
Comboxbox listindex in ActiveX Control
by brandoncampbell (1 replies)
you can check your answers here
hahahaa
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,
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 sound transfer in winsock with the use of visual basic,,if any one have the answer then please send me the reply as soon as possible.send reply on dthis maill address also. ======kuldip_infotech@yahoo.co.nz
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....
i experienced the same problem:
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
its great but cani enable for for proxy on LAN?.
This thread is for discussions of Client Server Programming with Winsock.