Winsock API client server app 
Author Message
 Winsock API client server app

I have a basic client/server app in which the client can contact the server
and send data to it successfully. What I want to do is to get the server
sending data back to the client using the same connection.

Any help or sample code appreciated.

Iain Marshall



Tue, 22 Mar 2005 22:42:16 GMT  
 Winsock API client server app
Take a look at:

http://www.vbip.com/

They also have a WinSock control replacement class that I find works better
than the actual MS WinSock control. Even if you don't use it, it is an
excellent example of how to properly use sockets (and there's a lot of green
matter).

HTH,
Jason Bouzane


Quote:
> I have a basic client/server app in which the client can contact the
server
> and send data to it successfully. What I want to do is to get the server
> sending data back to the client using the same connection.

> Any help or sample code appreciated.

> Iain Marshall



Tue, 22 Mar 2005 22:50:44 GMT  
 Winsock API client server app
just use a winsock tcp/ip connection and the server and client can send data
back and forth no problem
for multiple connections just use this code:

Private Sub winsock1_ConnectionRequest(Index As Integer, ByVal requestID As
Long)
If Index = 0 Then
intMax = intMax + 1
Load winsock1(intMax)
winsock1(intMax).LocalPort = 0
winsock1(intMax).Accept requestID
End If
End Sub

and it will allow multiple connections on the server then use a for each
loop to send data back to all the clients

Dim Temp3 As Winsock
For Each Temp3 In winsock1
If Temp3.State = 7 Then
Temp3.SendData ("Stuff To Send")
End If
Next Temp3

hope that help if u need more info i have a client server chat program that
i can email you

AvEnGer



Sat, 26 Mar 2005 15:13:33 GMT  
 Winsock API client server app


Quote:
> I have a basic client/server app in which the client can contact the
server
> and send data to it successfully. What I want to do is to get the server
> sending data back to the client using the same connection.

> Any help or sample code appreciated.

> Iain Marshall

Iain,

Are you using the Winsock Control, or the Winsock API?  I can help you if
your using the API, but I really know very little about the Control.  I am
assuming that your using tcp and not udp... But, the handle you get back
from accept, is usable for both read and write - as long as the client
closing the connection immediately after the send.  If you can post a little
code, I can probably help you out more.

Tom Shelton



Tue, 29 Mar 2005 23:09:27 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. How to make a client server app with winsock api

2. Winsock Server/Client using API

3. Launch app on Server to client, from client

4. LOCAL APP --> CLIENT SERVER APP

5. Client App wants Server App to start

6. http client with pure Winsock API

7. winsock control: determine server's port from client

8. winsock code sample for client-server in .Net

9. winsock help..client and server

10. Server/Client with Winsock Control.

11. Advanced VB5 Client/Server winsock question

12. Winsock Client / Server problem

 

 
Powered by phpBB® Forum Software