Code for Communicating over Sockets?



Code for Communicating over Sockets?..

Answer / Purshottum Das Chandwani

In ASP.NET, you can use the System.Net.Sockets namespace to create a TCP client and communicate over sockets. Here's a simple example:

```csharp
TcpClient client = new TcpClient("ServerIPAddress", Port);
NetworkStream stream = client.GetStream();
Byte[] buffer = Encoding.ASCII.GetBytes("Hello, World!");
stream.Write(buffer, 0, buffer.Length);
```

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More ASP.NET Code Interview Questions

How to send e-mail from an ASP.NET application?

16 Answers   DataPoint, Infosys, Persistent, Radar, TCS, Wipro,


How to Create Scrollable Micro Windows?

2 Answers  


how to design a ListView control?

1 Answers  


i have a gird with columns all are coming from database,this will bind in item templete in gridview as textboxex.and i have button below named Update.i want to update all the records in the grid,but if user change the value of one textbox,what is the easy way 2 do this

1 Answers   Crompton Greaves,


where is assembly are store

5 Answers   C DAC,


How to Bind Nested XML to a Repeater Control with Container.DataItem?

1 Answers  


How to get the row index on checking a Checkbox in a ListView

1 Answers  


Give coding for Implementing a Fixed GridView Header in ASP.NET?

1 Answers  


How to get the row index on checking a Checkbox in a ListView

1 Answers   TCS,


How to use Client-side Script to Focus Controls in ASP.NET?

1 Answers  


how the value of label is printed through a button in asp.net web application

3 Answers  


Data Reader Vs DataSet

5 Answers   TCS,


Categories
  • ASP.NET Code Interview Questions ASP.NET Code (46)
  • VB.NET Code Interview Questions VB.NET Code (9)
  • C Sharp Code Interview Questions C Sharp Code (51)
  • ADO.NET Code Interview Questions ADO.NET Code (8)