|
-
Nov 25th, 1999, 05:44 PM
#1
Thread Starter
Lively Member
How the hell are you suppost to use winsock??
I can draw the control but how do i send the commands over a network
-
Nov 25th, 1999, 08:23 PM
#2
Hyperactive Member
Try this???
This function is used to send data to a specific destination.
The following User Defined Type (UDT) is required:
Type sockaddr
sa_family As Integer
sa_data(14) As Byte
End Type
Where:
sa_family = For TCP/IP this should be the value of AF_INET (AF_INET = 2).
sa_data(14) = Interpretation of this data is based on sa_family. An internet address could be stored in the first 6 bytes of sa_data and the other 8 bytes could be zeroed.
The following function declaration is required:
Declare Function sendto Lib "wsock32.dll" (ByVal s As Long, ByRef buf As Any, ByVal buflen As Integer, ByVal flags As Integer, ByRef toaddr As sockaddr, ByRef tolen As Integer) As Integer
Where:
s = A descriptor identifying a connected socket
buf = A buffer for the incoming data
buflen = The length of buf
Flags = Specifies the way in which the call is made
toaddr = An optional pointer to the address of the target socket
tolen = The size of the address in toaddr
If no error occurs, sendto() returns the to number of bytes sent. This may be less than the number indicated by buflen. Otherwise, a value of SOCKET_ERROR is returned, and a specific error code may be retrieved by calling WSAGetLastError().
-
Nov 26th, 1999, 02:41 AM
#3
Lively Member
Ha Ha, I dont think thats quite what he wants, John!!
Draper, get a life and do some RESEARCH. Every1 else has to, why shouldnt you? There are loads of tutorials and sample progs out there, try 1 of them. Failing that, ring knowles!
------------------
jimmy
ICQ:35813919
mail:[email protected]
-
Nov 26th, 1999, 05:40 AM
#4
Thread Starter
Lively Member
Get a life lamer jimdalby
yes i do know you but grow up
People are suppsed to be mature
-
Nov 26th, 1999, 08:21 AM
#5
-
Nov 26th, 1999, 08:17 PM
#6
New Member
And this is for the "SERVER"
'for the module
Public intMax As Long
'for the form_load
Winsock1(0).LocalPort = 1001 'what ever you want!
Winsock1(0).Listen
'for the Winsock1_ConnectionRequest
If Index = 0 Then
intMax = intMax + 1
Load Winsock1(intMax)
Winsock1(intMax).LocalPort = 1001
Winsock1(intMax).Accept requestID
End If
------------------
-
Nov 27th, 1999, 07:39 AM
#7
Thread Starter
Lively Member
Thanks for the help but it keep erroring and saying that there is a syntax error in the line
Private Sub Winsock1_DataArrival(by value bytesTotal As Long)
I don't know why
Please help
Thanks
[This message has been edited by death (edited 11-27-1999).]
-
Nov 27th, 1999, 09:30 AM
#8
Hyperactive Member
of course it should .. u are writing it the wrong way , in my example i wrote it wront to ... so hwere how it is to be writen :
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
.... the routine i gave u in my example before ...
End Sub
note : this example has nothing to do with what jazz wrote .. what jazz wrote is a part of the TCP protocole way to do it ... what i gave u is the UDP way to do it ...
- regards -
- razzaj -
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|