.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

How to Send/ Receive Class/Structures with TCP using C# .Net...

Posted By:      Posted Date: September 16, 2010    Points: 0   Category :.NET Framework
Here I am looking out for 2-things! 1) A pointer/ notes on how to send/ receive data (a class object or structure) across the network using TCP/ UDP between 2-Windows machines. 2) However, the higher priority thing for me, as of now, is sending/ receiving data (a class object or structure) across the network between a WinXP machine(client-application) and Linux machine (the server application). Working with ‘unmanaged code/ WinSock APIs’ will be the only solution? <Note-1> Here, I am NOT looking to transfer the file/s OR FTP or something similar. Its purely objects/ structures. <Note-2> A cursory look suggested that NetworkStream and BinaryWriter can help me achieving data transfer between Windows PCs. _______________________________________________________________ Say, an example structure I need to Send/ Receive across is:     public struct Message2Linux {   public int MsgId;   public int paramCount;   public int[] paramArray; };     Many thanks in advance.

View Complete Post

More Related Resource Links

send data in class object from one page to another using session


hello everybody

now i hav stored all data like user name, data fatched from database of that user

and i stored that data and user name such as:

string strUserName="user name"

dataset ds =new dataset();// data of that user

now i wan yo send d whole data from my login page to user profile page

can anybody help me for that...................

and plz tell me that how much is this way is benifitial to send data from one page to another page

plz........kindly waiting for positive rply

Web Service that will receive xml request and send xml response


I am trying to create a web service that can do the following functionality:

Request XML 

<?xml version="1.0" encoding="UTF-8"?>
<Authentication UserName="test" Password="test" MyId="0987">

Response XML - After authenticating request xml from client send them back the following response:

<?xml version="1.0" encoding="UTF-8"?>
   <Test MyId="0987">
       <TestType id="11"></TestType>
       <TestType id="22"></TestType>

How can I create web service to do this.

Send/Receive SMS

I dont know whether this is the right place to post this. I have a situation here. I am new to .NET. I need to send/receive SMS using a vision COM , AT commands and a modem is involved in this. I am supposed to come up with an idea on how to implement this function in my project. Can some one help me out in this?

how to get a class reference as a reference and not a string to send for a generic method

I got some property that i get using generic method, there for I dont have it's <T>and I want to send it to another generic method but , how the heck do I get it's <T> :P?please look at the code below to understandit gets an entity framework objects, scan all it's properties and if the property is another entity framework object it would send it back to him self , the issue is that i dont know the new object <T> to send it back to him self :(search for the bold part to see what i'm missing//contains objects which we added so there wont be double adding private List<object> _addedObjects; public FakeGenericRepositoryExtension() { _addedObjects = new List<object>(); } public void Create<T>(T entity) where T : class { //add to created objects _addedObjects.Add(entity); //do something with object //... //start recircle process Type entityType = typeof(T); //run thrue each member of Type foreach (var member in typeof(Type).GetProperties()) { //get member value var member_value = member.GetValue(entity, null); //if not null //we must test this otherwise we can't get .BaseType if (member_value != null) { //get current member's base type string memberBaseType = member.GetValue(entity, null).GetType().BaseTyp

Programatically Send and receive data using Post Method

Hi,I wish to make a script which programatically send the POST data to one server and then the other server receive the POST message and retrieve the information. How should make this work? I already successfully write the sender site, the code as follow:string postData = "id=0&co=5";ASCIIEncoding encode = new ASCIIEncoding();         //data encoding         byte[] dataEncode = encode.GetBytes(postData);         //end ascii encoding scheme         string url = "http://localhost:51711/Handler1.ashx"; //         //web request         HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);         req.Method = "POST";         req.ContentType = "application/x-www-form-urlencoded";         req.ContentLength = dataEncode.Length;         //send data                Stream st = req.GetRequestStream();         st.Write(dataEncode, 0, dataEncode.Length);         st.Close();ASCIIEncoding encode = new ASCIIEncoding();byte[] dataEncode = encode.GetBytes(postData);stri

How to send and receive unique cookie to a user


Hi, I need to send a cookie to the my web site's visitors and receive them back for information. For example when machine1 visits my site if not set I set a cookie with "user1", for machine2 I set "user2" etc. 

Actually I need to retrieve the cookie back from my log file, so I thought if I do this it will be saved to my log file. Any help?

Thanks in advance

Pick with receive/send reply behavior

Hi all,

I have this workflow (simplified view):

				<Receive CanCreateInstance="True"/>

The LongRunningActivity is a code activity which runs another workflow [through Task.Factory.StartNew(() => workflowApplication.Run())] and waits with a ManualResetEvent the completion of the inner workflow. The inner workflow contains other receive activities.
This is the Execute code of the LongRunningActivity CodeActivity:

WaitHandle waitHandle = new ManualResetEvent(false);
        // ...
        WorkflowApplication workflowApplication = new WorkflowApplication(definition);
        workflowApplication.Completed = args =>
        Task.StartNew(() => workflowApplication.Run());

When I run it, I have the same behavior:

Can't I send and receive emails without exchange server?


Hello Friends,

I know this question of mine sounds weird but here goes. I am installing SharePoint 2010 on a standalone machine which has its own AD, SMTP. Now I would like to enable email communications within the system and almost all the forums I come across say that exchange server is needed for email communication. My question is can't this be done without exchange server???

If the exchange server is not needed please do provide me with instructions on how to go ahead with my installation.

Thanks & Regards, Chandra Shekhar Rameneni

Class Diagrams

Class diagrams show the static structure of the systems. Classes define the properties of the objects which belong to them. These include:

Attributes - (second container) the data properties of the classes including type, default value and constraints.

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

Static Class for Beginners

In general, the members of a class can be accessed by instance of that class when they are in public, but there comes a situation to access or call members of a class without an instance and this can be achieved by declaring them as static

abstract away the source of the connection string using a class with a static property.

ASP.NET provides a configuration system we can use to keep our applications flexible at runtime. In this article we will examine some tips and best practices for using the configuration system for the best results.

The element of a web.config file is a place to store connection strings, server names, file paths, and other miscellaneous settings needed by an application to perform work. The items inside appSettings are items that need to be configurable depending upon the environment, for instance, any database connection strings will change as you move your application from a testing and staging server into production.

Let's abstract away the source of the connection string using a class with a static property.

MessageQueue Class

This sample demonstrates two way communications using message queuing between a device application and a desktop application. One application sends book order messages to a message queue and another application receives these book orders from the message queue and responds to the device queue that the orders have been processed.

Send Email from SQL Server Express Using a CLR Stored Procedure

One of the nice things about SQL Server is the ability to send email using T-SQL. The downside is that this functionality does not exist in SQL Server Express. In this tip I will show you how to build a basic CLR stored procedure to send email messages from SQL Server Express, although this same technique could be used for any version of SQL Server.

If you have not yet built a CLR stored procedure, please refer to this tip for what needs to be done for the initial setup.

How to change the default page base class?


I've tried setting the <pages pageBaseType="DynamicWebPage" /> value in web.config, but when I response.write out the page type, I'm still getting Microsoft.WebPages.WebPage.

I'm simply trying to sub-class WebPage and add some additional functionality such as a dynamic PageData dictionary similar to Phil Haack's dynamic ViewData dictionary.



Send object from one page to another



I want to create object in 1.aspx, and then send it to 2.aspx. This methods are bad, because:

1)Send object with url, like this:


This is not confidential.


Session["field1"] = "12345"; // set
Object foo = Session["field1"]; // get

This is bad too, because in 2.aspx this fields send to textboxes, and if user go to 2.aspx without 1.aspx, he'll see old data. 

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