Hello There, Guest!
View New Posts  |  View Today's Posts
[VB.Net] Multi-Client Server Async Socket Example

ii 
  • 4 Vote(s) - 4.5 Average


11-20-2015, 07:03 PM #161
KoBE
¯\_(ツ)_/¯
******
Global Moderators
Posts: 4,862 Threads:494 Joined: Jun 2011 Reputation: 67

RE: Multi-Client Server Async Socket Example
Hey Hans, please post the code you're trying and I'd be glad to look at what might be wrong.

11-21-2015, 01:55 AM #162
Hans
Junior Member
**
Posts: 6 Threads:1 Joined: Nov 2015 Reputation: 0

RE: Multi-Client Server Async Socket Example
(11-20-2015, 07:03 PM)KoBE Wrote:  Hey Hans, please post the code you're trying and I'd be glad to look at what might be wrong.

Hi KoBE - Thanks for your kind offer to help a newbee in case of client/server!
Very simple thing  (but not for me yet)  - I like to send a Nickname from the Client Form to the Server:
Code:
If TextBox1.Text <> "" Then
           NickName = TextBox1.Text
           Send(NickName, clientSocket)
       End If


I see the IP and Port transferred, but no idea where to plug in this little piece of code! Just adding the snippet at the end of the "Connect" Sub seems not the way, as at this point the client seems to "listen" for messages. How do I get this transferred? Sad

01-26-2016, 07:53 PM #163
birderbob
Junior Member
**
Posts: 1 Threads:0 Joined: Jan 2016 Reputation: 0

RE: Multi-Client Server Async Socket Example
Great post and example.  It works great.  But when I try to execute the client and server on two machines on my LAN, the client does not find the server.  It works great when the two programs are executed on the same machine. Where can I put in the IP of the server machine?  Thanks.
This post was last modified: 01-26-2016, 07:54 PM by birderbob.

02-14-2016, 09:53 AM #164
4mako
Junior Member
**
Posts: 1 Threads:0 Joined: Feb 2016 Reputation: 0

RE: Multi-Client Server Async Socket Example
Hi Kobe,

Firstly, your code and video is very helpful!!!  I salute you for posting it as it helps new aspiring programmer understand complex tasks,
I downloaded your code and ran it in my laptop.  What I notices is that, when the connect button was clicked twice, the server side list it as 2 separate connections and when I tried to send message to both listed connection eventually the server is no longer be able to send messages to the first connection in the list, but the second connection is still receiving messages.
I did that test because when I used your server code for my own application, what I found is that when I have to clients connected, the server can respond to 2 clients for the first few messages sent by the server.  And then eventually the first client is no longer able to receive messages from the server but the second client is still ok.
Do you have any idea on why it is behaving that way?
Also, what I am trying to accomplish is a little bit different from a chat application.
The program that I've got is basically a sender and a listener where the sender sends data to the listener and wait for a response from the server. 
The server's task is to wait for a connection, receive the incoming data from the client connection then pass it to a web service which then process the data.  The web service will then return the processed data back to the server then the server will pass the processed data back to the client.
Hope you can guide me to a solution on this one.

Thanks!

02-15-2016, 04:28 AM #165
Mazzn
ლ(ಠ益ಠლ)
*******
Administrators
Posts: 199 Threads:16 Joined: Sep 2013 Reputation: 19

RE: Multi-Client Server Async Socket Example
My first thought is that the first connection is abandoned once you connect a second time and the server keeps it alive for a little while, but since no ping/pong messages are sent anymore it times out eventually.

How do you handle connecting twice? You should create a second instance of the IrcClient object (I think that was the name of the class - didn't work with the code for a while) and connect twice using these two separate instance instead of using one instance to connect twice.

Sorry, being at work I didn't have the time to research all that, nor could I test anything, but I hope I understood your question correctly and could help you out!
Visit me at mazzn.net & blog.mazzn.net!
//This is very important :)

Self.KeepImproving(true);


09-10-2016, 05:17 AM #166
R4TK3N
Junior Member
**
Posts: 1 Threads:0 Joined: Sep 2016 Reputation: 0

RE: Multi-Client Server Async Socket Example
Thanks to this master . thans mate


ii 


Forum Jump:


Possibly Related Threads...
Thread Author Replies Views Last Post
Exclamation  problem multi post + httpwebrequest read ip sharokurdi 1 1,202 11-11-2016, 06:39 PM
Last Post: AceInfinity
   Create your own IRC Client [C#/VB.Net] KoBE 185 116,367 10-01-2016, 06:57 PM
Last Post: AceInfinity
   IRC Client Class KoBE 110 71,655 10-01-2016, 06:52 PM
Last Post: AceInfinity
  Telnet Client AceInfinity 5 2,647 06-05-2016, 07:48 PM
Last Post: AceInfinity
   Twitch chat bot (irc client) dmgvol 11 18,945 08-24-2015, 11:59 PM
Last Post: Signal_20


Users browsing this thread: 1 Guest(s)