OK,
Give me a little time, I'm kind of busy right now, but I'll take a look when I get a chance. In the mean time, you could play around with your code to see under what conditions you could get it to send data like the demo program did.
Printable View
OK,
Give me a little time, I'm kind of busy right now, but I'll take a look when I get a chance. In the mean time, you could play around with your code to see under what conditions you could get it to send data like the demo program did.
Ok no problem. I'll be here ;)
Ok i got it sending data to the server working. But now the problem is receiving and displaying data in the client that's sent from the server.
I tried:
But it's not working :sick:VB Code:
Dim msg As String If myrecv(ConnectSocket, msg, Len(msg), 0) = SOCKET_ERROR Then MsgBox "error getting data" Else MsgBox msg End If
..............................
My myrecv function:
I have the "recvString" API declared the same as "sendString" you gave me.VB Code:
Public Function myrecv(ByVal s as Long, ByVal buf As String, ByVal buflen As Long, ByVal flags As Long) As Long Dim out As Long out = recvString(s, buf, buflen, 0) myrecv = out End Function
OK, try this
VB Code:
Public Declare Function recvString _ Lib "ws2_32.dll" Alias "recv" (ByVal s As Long, _ ByVal buf As String, _ ByVal buflen As Long, _ ByVal flags As Long) As LongVB Code:
Dim bytesSent As Long Dim bytesRecv As Long Dim recvbuf As String Dim myError As Long recvbuf = String(32, 0) bytesRecv = recvString(ConnectSocket, recvbuf, Len(recvbuf), 0) If bytesRecv <= 0 Then myError = WSAGetLastError If bytesRecv = 0 Or myError = WSAECONNRESET Then MsgBox "Connection Closed." Exit Sub Else MsgBox "Receive Error: " & Hex(myError) WSACleanup Exit Sub End If End If MsgBox "Message Received: " & "(" & CStr(bytesRecv) & ") " & recvbuf
Works. Thanks alot for all the help moeur.. I appreciate it.
You can download the soft calles Api-Guide from http://www.allapi.net/ which has good examples for all the api ,
Try the api (inet_addr) for your problem