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

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

C# Socket programming

Posted By:      Posted Date: September 13, 2010    Points: 0   Category :.NET Framework
Hi,       Im having a problem with some socket programming and im hoping someone here can help me. basically im trying to bind a listener to a port. I have used some source code i obtained from the net, however the code was a few years old and contained the obsolete "Dns.Resolve(string.Empty);" method to get the IPHostEntry information. Ive tried to replace this with "Dns.GetHostEntry(string.Empty);" however my code does not seem to be excuting past this point so im wondering if i have a logical error. this is the original method private void AcceptConnections() { IPHostEntry localMachineInfo; IPEndPoint localEndPoint; Socket listener = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); try { localMachineInfo = Dns.Resolve(string .Empty); localEndPoint = new IPEndPoint(localMachineInfo.AddressList[0], _port); // Bind the listener socket to a local port listener.Bind(localEndPoint); // Set the socket in a 'listener' mode listener.Listen(10); // Continue accepting and processing new connections indefinitely while (true ) { threadEvent.Reset();

View Complete Post

More Related Resource Links

Webservice using socket layer programming



   I want to access a webservice in asp.net programming. This webservice was done using socket layer programming and also i am having the ipaddress and port address. Did any one know about how to access webservice using socket layer and if know let me know how to access the webservice. Thank you

Getting Error in Socket Programming...


I am creating one application with socket programming.
I am using visual studio 2008 with windows 7.
I am getting a error Message...

at line....



"No connection could be made because the target machine actively refused it"

class Class1{



void Main(string[] args)



IPAddress[] ipAddress = Dns

Socket Programming-error


AsyncClient.cs(247,40): warning CS0618: 'System.Net.IPAddress.Address' is obsolete: 'This property has been deprecated. It is address family dependent. Please use IPAddress.Equals method to perform comparisons.

Get Same Buffer Size in Socket Programming


Dear All,

Actually i am developing an app which send audio file from client to server and server read the byte and save that file in waver format problem is that  i want to send buffer size of audio file or audio length to server but didint get the same size so plz help me regarding this prob

i am using c#

Coding / Programming Tips for C#

Using proper guidelines and a template-framed style of coding will really helps developer to enjoy the coding with more understandable, reliable code and application development.

C# Object Oriented Programming

So far in C# Essentials we have looked at the basics of programming in C# such as variable types and flow control. Although it would be possible to write a functional program using these techniques, there is much more to becoming a proficient C# programmer. C# is, above all, an object oriented programming language and as such any C# programmer will be expected to create object-oriented applications using this language.

Object Oriented Programming

Four core concept of OOP Object Oriented Programming. 1.Inheritance, 2.Polymorphism, 3.Abstraction and 4.Encapsulation

Object-Oriented Programming Concepts

This is the first in a series of articles describing the use of object-oriented programming techniques as implemented by the C# programming language. This series follows the C# Fundamentals tutorial that beginners are advised to read first.

Parallel port complete: programming, interfacing & using the PC's parallel

Parallel port complete: programming, interfacing & using the PC's parallel


F# Basics: An Introduction to Functional Programming for .NET Developers


F# has clean syntax, powerful multi-threading capabilities, and fluid interoperability with other Microsoft .NET Framework languages. We'll give you an introduction to functional programming concepts and how they're implemented in F#.

Chris Marinos

MSDN Magazine April 2010

Patterns in Practice: Functional Programming for Everyday .NET Developers


This article examines how the new support for functional programming techniques in .NET 3.5 can developers make code more declarative, reduce errors in code, and write fewer lines of code for many common tasks.

Jeremy Miller

MSDN Magazine October 2009

Toolbox: Managing in the Cloud, UX Design Patterns, Anders Hejlsberg's The C# Programming Language,


Now that you're even managing projects in the cloud, you'll need some tools to help. This month we illustrate one, discuss UX design patterns, a book by Anders Hejlsberg, and more.

Scott Mitchell

MSDN Magazine June 2009

Under the Table: Programming with FileStreams in SQL Server 2008


There's always been disagreement about whether large blobs, such as document and multimedia items, should be stored in the database or file system. In SQL Server 2008 you don't have to choose; filestream storage provides the best of both approaches.

Bob Beauchemin

MSDN Magazine May 2009

Toolbox: The Active Record Pattern, Aspect-Oriented Programming


This month we look at implementing the Active Record Pattern in your .NET application and how aspect-oriented programming yields separation of concerns.

Scott Mitchell

MSDN Magazine February 2009

Paradigm Shift: Design Considerations For Parallel Programming


This article presents an overview of the motivation behind new techniques that decompose problems into independent pieces for optimal use of parallel programming.

David Callahan

MSDN Magazine October 2008

Cutting Edge: Programming AJAX with ASP.NET Partial Rendering


Dino Esposito compares the use of AJAX patterns and DOM manipulations to the use of the ASP.NET partial rendering engine.

Dino Esposito

MSDN Magazine August 2008

F# Primer: Use Functional Programming Techniques in the .NET Framework


Here we introduce you to some of the concepts behind the new F# language, which combines elements of functional and object-oriented .NET languages. We then help you get started writing some simple programs.

Ted Neward

MSDN Magazine Launch 2008

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