Click here to Skip to main content
15,881,870 members
Home / Discussions / C#
   

C#

 
GeneralRe: source code to eliminate power line noise frm ECG signal Pin
ashwiny21-Sep-07 7:30
ashwiny21-Sep-07 7:30 
GeneralRe: source code to eliminate power line noise frm ECG signal Pin
ekynox22-Sep-07 18:05
ekynox22-Sep-07 18:05 
QuestionHelp needed in DataGridView Pin
Exelioindia23-Aug-07 23:28
Exelioindia23-Aug-07 23:28 
AnswerRe: Help needed in DataGridView Pin
Rocky#24-Aug-07 0:09
Rocky#24-Aug-07 0:09 
AnswerRe: Help needed in DataGridView Pin
Alaric_24-Aug-07 3:50
professionalAlaric_24-Aug-07 3:50 
QuestionFast possiblity to send data from Server to Client Pin
hansipet23-Aug-07 21:43
hansipet23-Aug-07 21:43 
AnswerRe: Fast possiblity to send data from Server to Client Pin
hansipet23-Aug-07 21:46
hansipet23-Aug-07 21:46 
AnswerRe: Fast possiblity to send data from Server to Client Pin
Hessam Jalali23-Aug-07 23:40
Hessam Jalali23-Aug-07 23:40 
Seems you are using Remoting and in .NET remoting you can send streams from server side to client with requesting it from the client area
I used it for sending none shared files from the server to client and the speed was far more 1MByte/Sec (but this method is not such a secure one for file sharing!)

and ofcourse with sending streams you can send all types of data (so you can send your instances as Data with serializing them on the fly in memory stream and then send the stream to client)

I can't give you a complete code because it was part of a bigger project and I must send you lots of code to work

but here is the code I wrote for testing it is possible to do this or not

sorry the code is somewhat messy (it was for testing puposes only)

the share part
namespace NetTest
{
    public class RemoteFileBrowser:MarshalByRefObject
    {
        public delegate void EventFireHandler();
        public event EventFireHandler eventFiredFromRemoteObject;

        public RemoteResult GetStream(string path)
        {
            if (!File.Exists(path)) return new RemoteResult();

            return new RemoteResult(new FileStream(path, FileMode.Open));
        }

        public RemoteResult Failed()
        {
            return new RemoteResult();
        }

        public string GetMachineName()
        {
            return Environment.MachineName;
        }

        public string GetAuthor()
        {
            if (this.eventFiredFromRemoteObject != null) this.eventFiredFromRemoteObject();
            return "Hessam Jalali";
        }

    }
}


the server side
class Program
{
    static void Main(string[] args)
    {
        Console.WriteLine("Host Started");

        TcpChannel tc = new TcpChannel(50000);
        ChannelServices.RegisterChannel(tc,false);

        RemoteFileBrowser rfb = new RemoteFileBrowser();

        rfb.eventFiredFromRemoteObject += new RemoteFileBrowser.EventFireHandler(rfb_eventFiredFromRemoteObject);
        RemotingConfiguration.RegisterWellKnownServiceType(rfb.GetType(), "rfb.rem", WellKnownObjectMode.Singleton);

        Console.WriteLine();
        Console.WriteLine("Press any key to Exit...");
        Console.ReadKey();

        ChannelServices.UnregisterChannel(tc);

    }

    static void rfb_eventFiredFromRemoteObject()
    {
        Console.WriteLine("Event Fired inside");
    }
}


and the client side
namespace NetTestClient
{
    static class Program
    {

        static void Main()
        {

            Console.WriteLine("Enter Address");

             string uri=Console.ReadLine();


            #region Remote File Stream
            //string uri = "tcp://localhost:50000/rfb.rem";

            RemoteFileBrowser remoteRfb = RemotingServices.Connect(typeof(RemoteFileBrowser), uri) as RemoteFileBrowser;
(remoteRfb_eventFiredFromRemoteObject);
            Console.WriteLine(remoteRfb.GetAuthor());
            Console.WriteLine("Remote Machine is " + remoteRfb.GetMachineName());


            RemoteResult remoteRes = remoteRfb.GetStream(@"N:\Tools for Linux.iso");

            RemoteResult remoteFailed = remoteRfb.Failed();//just for testing

            Console.WriteLine();
            Console.WriteLine(remoteRes.Message + "  Continue...");
            Console.ReadKey();

            if (remoteRes.Succeed)
                using (StreamReader br = new StreamReader(remoteRes.File))
                {
                    Console.WriteLine();
                    Console.WriteLine("Dumping File");
                    Console.WriteLine();

                    while (!br.EndOfStream)
                        Console.WriteLine(br.ReadLine());
                }
            remoteRes = null;

            #endregion


            Console.ReadKey();
        }
    }
}


hope the post would be useful
GeneralRe: Fast possiblity to send data from Server to Client Pin
hansipet24-Aug-07 0:04
hansipet24-Aug-07 0:04 
GeneralRe: Fast possiblity to send data from Server to Client Pin
Hessam Jalali24-Aug-07 0:57
Hessam Jalali24-Aug-07 0:57 
QuestionC# and Windows Visual Style Pin
greekius23-Aug-07 21:35
greekius23-Aug-07 21:35 
AnswerRe: C# and Windows Visual Style Pin
Talal Sultan23-Aug-07 21:55
Talal Sultan23-Aug-07 21:55 
GeneralRe: C# and Windows Visual Style Pin
greekius23-Aug-07 22:28
greekius23-Aug-07 22:28 
GeneralRe: C# and Windows Visual Style Pin
Talal Sultan23-Aug-07 23:19
Talal Sultan23-Aug-07 23:19 
AnswerRe: C# and Windows Visual Style Pin
\laddie23-Aug-07 22:02
\laddie23-Aug-07 22:02 
GeneralRe: C# and Windows Visual Style Pin
Thomas Stockwell25-Aug-07 2:40
professionalThomas Stockwell25-Aug-07 2:40 
GeneralSuggestion for Administrators Pin
Rocky#23-Aug-07 21:33
Rocky#23-Aug-07 21:33 
GeneralRe: Suggestion for Administrators Pin
Martin#23-Aug-07 21:40
Martin#23-Aug-07 21:40 
GeneralRe: Suggestion for Administrators Pin
Vasudevan Deepak Kumar23-Aug-07 22:03
Vasudevan Deepak Kumar23-Aug-07 22:03 
GeneralRe: Suggestion for Administrators Pin
J4amieC23-Aug-07 22:15
J4amieC23-Aug-07 22:15 
QuestionSQL or query Pin
falles0123-Aug-07 21:18
falles0123-Aug-07 21:18 
AnswerRe: SQL or query Pin
Martin#23-Aug-07 21:28
Martin#23-Aug-07 21:28 
GeneralRe: SQL or query Pin
falles0123-Aug-07 21:32
falles0123-Aug-07 21:32 
GeneralRe: SQL or query Pin
falles0123-Aug-07 21:35
falles0123-Aug-07 21:35 
GeneralRe: SQL or query Pin
Martin#23-Aug-07 21:38
Martin#23-Aug-07 21:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.