.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
Imran Ghani
Post New Web Links

A Simple Sample of a TcpListener and Client

Posted By:      Posted Date: September 20, 2010    Points: 0   Category :.NET Framework
 

Well For the last 2 weeks I been going threw all the samples on google that I can fine. and well they just don't work in a windows form. Ir they just don't work.

 

The Sever

I have one TextBox and 2 buttons (Start and Stop)

 

The Client

I have 2 text box and 3 buttons

Textbox 1 is for messages from server

Textbox 2 is for that user to send message and a button to send

The other 2 buttons are (Connect and DisConnect)

 

Can any one tell me where I can get a Simple TcpListener and and TcpClient for a windows Form that is that simple.

Thanks

Joe

 

 

 


Toppers BBS http://toppersbbs.dtdns.net C# Windows and Console applications. PHP, Mysql. HTML


View Complete Post


More Related Resource Links

Looking for a simple Service and Console Client REST sample implementing BASIC authentication

  

Does anyone know of a C# code sample demonstrating WCF REST services and console test client with OperationContracts (GET and POST) implementing mutiple paramaters using BASIC authentication? Also, perhaps, using Fiddler as a test client as well? I have searched high and low for something like this, but have not had any success.


Windows UI: Our WinMgr Sample Makes Custom Window Sizing Simple

  

Programmers using Visual Basic have always had an advantage over C++ programmers when it comes to component and window sizing. There are many third-party Visual Basic-based solutions to this age-old problem, but unfortunately, there are few elegant alternatives for the C++ crowd, short of using a full-fledged windowing toolkit. This article explains how to circumvent the tedious task of hardcoded pixel arithmetic. It starts by introducing a window sizing rules system, and then moves on to show how CWinMgr, a data-driven class, can intelligently manage an MFC application's window sizing.

Paul DiLascia

MSDN Magazine July 2001


Sample: Accessing SharePoint 2010 Data with the .NET Client Object Model

  
Explore the code in this visual how-to article as you learn to use the SharePoint 2010 managed client object model to read and write data in SharePoint sites from Microsoft .NET Framework-based applications.

C#, sockets, Windows and port 21 : A simple Client-server using TCP; connection dies after transfer

  

Hello,

I have a thread on Stackoverflow here:

http://stackoverflow.com/questions/4118800/c-networking-server-hangs-after-receiving-more-than-65535-bytes

In short: 

In a very VERY simple Client-Server solution the TCP connection dies after sending 65535 bytes. This only happens when I am connected on port 21. If I change the server port to for example port 22 the connection does not die.

I am posting the simple code here for reference.

CLIENT:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.Threading;
using System.Net.Sockets;

namespace tWorks.Samcom.PassSocketPoller
{
  public class PollerTest2
  {
    private IPAddress _sutiSocketIpAddr;
    private int _sutiSocketPort;

    private Thread pollerThread = null

Looking 4 a simple TCPClient.BeginConnect sample...

  

Networking code, makes my head hurt.

I am trying to create a class that implements a form of connectionless messaging. I have my DoSendMessage method  that is using TCPClient.Connect but the problem is that if the server is not availible the Connect method hangs for about 5 secs while it tries to connect. Meaning my application also hangs. Very bad....

What I am looking for is a COMPLETE and WORKING sample that is simple and uses the asynronous method for connecting using TCPClient.BeginConnect. But I have not been able to track down any easy to fallow sample code.

Does anybody know of any tutorials or links that can help me out. Thanks in advance!

My code is as fallows ...

  Private Sub DoSendMessage(ByVal Server As IPAddress, ByVal Port As Integer, ByVal Message As String, ByVal Raiseevents As Boolean)
        If Server Is Nothing Then Exit Sub
        ' If Server = String.Empty Or Message = String.Empty Then Exit Sub
        ' If Server.Contains(":") Then Server = Server.Substring(0, Server.IndexOf(":"))

        Try
            ' Create a TcpClient.
            ' Note, for this client to work you need to have a TcpServer
            ' connected to the same address as specified by the server, port
            ' combination.
            Dim client As New TcpClient
            client.ExclusiveAddressUse = False
            client.

Sample: Accessing SharePoint 2010 Data with the Silverlight Client Object Model (Visual How To)

  
Explore code that shows how to use the SharePoint 2010 managed client object model to read and write data in SharePoint sites from Silverlight applications.

Sample: Integrating Client Applications with SharePoint 2010 Workflows

  
Explore the code that shows how to create a WPF application that calls a WCF service to submit data into a SharePoint site and update the status of a custom SharePoint workflow.

Sample: Creating Simple Web Part Mashups with InfoPath 2010

  
Explore the code as you learn to create a simple Web Part mashup on SharePoint Server 2010 with InfoPath 2010 and the InfoPath Form Web Part.

Simple select on client very slow, fast on server

  

We copied a database from SQL Server 2005 to SQL Server 2008 R2 on a new server.

On the new server (24 cores, 24 gig memory) simple select statements from my client with SSMS that returns 10000 rows take about 50 seconds. The same query on the old server (1 core) takes less than 1 second. Directly on the new server the query runs very fast (also less than 1 second).

Execution Plans on both servers are exactly the same.

Client Statistics shows on the old machine under "Client processing time" 656 and on the new server 51018.

The same problem occurs on all other clients and with any other larger query/resultset.

It looks like a network issue. But the new server is located in the same datacenter and has a 1000Mbps network connection.

Any help is greatly appreciated.


Michael

Use jQuery and ASP.NET AJAX to build a client side Repeater

  
By sending only data to the client, you can profoundly reduce the size of what you send and see a substantial increase in performance. You also allow yourself the ability to easily add features like light-weight sorting and paging on the client. This can not only improve your users' experience, but reduce server load and bandwidth requirements.

Client Side Gridview Pagination using JQuery

  
I would like to show how to use Client Side Gridview Pagination using Jquery Table Pagination Plugin by using Ryan Zielke.

Use jQuery and ASP.NET AJAX to build a client side Repeater

  
By sending only data to the client, you can profoundly reduce the size of what you send and see a substantial increase in performance. You also allow yourself the ability to easily add features like light-weight sorting and paging on the client. This can not only improve your users' experience, but reduce server load and bandwidth requirements.

To that end, I'm going to walk you through these four steps to effectively implementing a client side Repeater, using ASP.NET AJAX and jQuery:

Practical Multithreading for Client Apps

  
Writing applications that use multiple threads is often considered an advanced programming task, prone to errors. In this month's column, I'll focus on a practical application of multithreading in Windows® Forms applications with some real benefits, while attempting to keep things simple. My goal is to present multithreading in an approachable way that addresses a very common need: writing applications with a user interface that remain responsive to the user.

Creating a Simple Class in C#

  
The second article in the C# Object-Oriented Programming tutorial describes how classes are created in C# and how behaviour, in the form of publicly visible and private, hidden methods can be added. This demonstrates some of the uses of encapsulation

A Simple and Extensible Radio Button Style GridView

  
The GridView is one of the significant controls in ASP.NET 2.0 and later versions. No doubt it reduces a lot of work time. However, customizing the GridView control is not an easy task. For example, it's hard to add a radio button column to the GridView. This article demonstrates the reason why a radio button column cannot act as normal and how to create a simple and extensible radio button GridView.

Abstract Factory Design Pattern (Sample in C# and VB .NET)

  
An abstract factory provides an interface for creating families of related objects without specifying their concrete classes. Sometimes one wants to construct an instance of one of a suite of classes, deciding between the classes at the time of instantiation. In order to avoid duplicating the decision making everywhere an instance is created, we need a mechanism for creating instances of related classes without necessarily knowing which will be instantiated.

Silverlight Simple Animation

  
Silverlight has several built in techniques for animating controls. Many of these technologies are particularly useful for creating simple animations meant to decorate a web page with eye catching movement that draws the reader's attention. In this post I will skip over these decorative technologies, and instead show how to create a simple animation using a technique similar to those used in many games.
Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend