Solved

Need socket example

Posted on 2006-10-19
2
322 Views
Last Modified: 2008-02-01
Hi, having alot of problems with async sockets and have kind of given up. If anyone can create a small sample of these features, points are yours.

I need a console application that is able to open up 2 connections to 2 _different_ servers, at the same time.

One should run on a thread and send "PING" to the server, once every xx seconds.
The other should just run normally as I'm expected to send commands to the stream - written from the console.

I don't mind what you use, TcpClient or Socket, aslong as both connections to the server's running until I close the application.

Some of the problems i'm having is doing while loops to keep reading for data, I always end up with only 1 line of data, then not being able to read anymore.

I've tried the async client socket example from MSDN, but it won't give a reply back. Server is sending '\0' char at the end I believe.

Thanks!
0
Comment
Question by:valvet
2 Comments
 
LVL 48

Accepted Solution

by:
AlexFM earned 500 total points
ID: 17769307
Did you read this sample:
http://www.microsoft.com/downloads/details.aspx?familyid=08e3d5f8-033d-420b-a3b1-3074505c03f3&displaylang=en

Asynchronous socket chat sample can be found in the CSharp.msi file - download and install it. It is quite simple and can help to write your own code. And it is really working.
0
 

Author Comment

by:valvet
ID: 17769663
Great resource. Have not seen that before.

Thank you!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction                                                 Was the var keyword really only brought out to shorten your syntax? Or have the VB language guys got their way in C#? What type of variable is it? All will be revealed.   Also called…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now