Remoting (but need a binary data transfer)

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Sunny

    Remoting (but need a binary data transfer)

    Hi all,
    I'm creating client/server app in C# (VS. 2003).
    So, I need the client to call the server with some auth info (user and
    pass).
    If the auth is OK, server will do some work and will prepare a zip-file
    and some other text and numeric data and will notify the client that
    everything is ready.
    And the client will fetch the data.

    So if it was all console/desktop application, I know what to do (in
    basic):

    //server
    class MyWorkClass
    {
    public string sRetData;
    public int nRetData;
    public byte[] aRetData;

    public event I_AM_ready .... //
    public bool Connect(string username, string pass)
    {
    if CheckAuth(usern ame, pass)
    {
    DoTheWork();
    sRetData = "HERE IS THE DATA";
    nRetData = 1001; //just as example
    aRetData = new byte[1000000];
    aRetData = ...//fill it with data from the file
    return true;
    }
    else return false;
    }

    private void DoTheWork()
    { ...
    fire some events to show progress ... }

    private bool CheckAuth(strin g u, string p)
    { ... }
    }


    //client


    MyWorkClass myServer = new MyWorkClass();
    // subscribe event handler
    myServer.I_AM_R eady += ....
    if (myServer.Conne ct(myname, mypass))
    // do something with the data



    So, can I use all these samples (tutorials, etc.for remoting) to do such
    a thing? Is there a problem with the array?
    Will it prepare a XML tag for every byte from the array (then the
    traffic will be HUGE, and I want to avoid this)?

    Also, I didn't find any info about what is happening at the server side,
    is it creating a new instance of the class for every client, or there is
    only one (like static) copy?


    Thank you very very much for reading all this. I'd highly appreciate
    every single suggestion, explanation, example, etc.

    Thanks again
    Sunny
  • Jeffrey Tan[MSFT]

    #2
    RE: Remoting (but need a binary data transfer)


    Hi Sunny,

    Thank you for posting in this group.

    You can fulfill you work with .Net Remoting.
    In the server side, there are 3 ways of creating object for your request:
    1.server side activation----singlecall
    Create object instance for every request
    2.server side activation----singleton
    Create only one instance for all the request.
    3.client side activaction
    Create only one instance for the same client request

    You can select different server side creation deside by your program logic.

    Hope this helps

    Best regards,
    Jeffrey Tan
    Microsoft Online Partner Support
    Get Secure! - www.microsoft.com/security
    This posting is provided "as is" with no warranties and confers no rights.

    --------------------
    | From: Sunny <sunnyask@icebe rgwireless.com>
    | Subject: Remoting (but need a binary data transfer)
    | Date: Tue, 16 Sep 2003 15:50:28 -0500
    | Message-ID: <MPG.19d1339027 4bafd598968f@ms news.microsoft. com>
    | Organization: Iceberg Wireless LLC
    | MIME-Version: 1.0
    | Content-Type: text/plain; charset="iso-8859-15"
    | Content-Transfer-Encoding: 7bit
    | X-Newsreader: MicroPlanet Gravity v2.60
    | Newsgroups: microsoft.publi c.dotnet.langua ges.csharp
    | NNTP-Posting-Host: 216.17.90.91
    | Lines: 1
    | Path:
    cpmsftngxa07.ph x.gbl!cpmsftngx a10.phx.gbl!TK2 MSFTNGXA05.phx. gbl!TK2MSFTNGP0 8
    .phx.gbl!TK2MSF TNGP12.phx.gbl
    | Xref: cpmsftngxa07.ph x.gbl microsoft.publi c.dotnet.langua ges.csharp:1846 65
    | X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.csharp
    |
    | Hi all,
    | I'm creating client/server app in C# (VS. 2003).
    | So, I need the client to call the server with some auth info (user and
    | pass).
    | If the auth is OK, server will do some work and will prepare a zip-file
    | and some other text and numeric data and will notify the client that
    | everything is ready.
    | And the client will fetch the data.
    |
    | So if it was all console/desktop application, I know what to do (in
    | basic):
    |
    | //server
    | class MyWorkClass
    | {
    | public string sRetData;
    | public int nRetData;
    | public byte[] aRetData;
    |
    | public event I_AM_ready .... //
    | public bool Connect(string username, string pass)
    | {
    | if CheckAuth(usern ame, pass)
    | {
    | DoTheWork();
    | sRetData = "HERE IS THE DATA";
    | nRetData = 1001; //just as example
    | aRetData = new byte[1000000];
    | aRetData = ...//fill it with data from the file
    | return true;
    | }
    | else return false;
    | }
    |
    | private void DoTheWork()
    | { ...
    | fire some events to show progress ... }
    |
    | private bool CheckAuth(strin g u, string p)
    | { ... }
    | }
    |
    |
    | //client
    |
    |
    | MyWorkClass myServer = new MyWorkClass();
    | // subscribe event handler
    | myServer.I_AM_R eady += ....
    | if (myServer.Conne ct(myname, mypass))
    | // do something with the data
    |
    |
    |
    | So, can I use all these samples (tutorials, etc.for remoting) to do such
    | a thing? Is there a problem with the array?
    | Will it prepare a XML tag for every byte from the array (then the
    | traffic will be HUGE, and I want to avoid this)?
    |
    | Also, I didn't find any info about what is happening at the server side,
    | is it creating a new instance of the class for every client, or there is
    | only one (like static) copy?
    |
    |
    | Thank you very very much for reading all this. I'd highly appreciate
    | every single suggestion, explanation, example, etc.
    |
    | Thanks again
    | Sunny
    |

    Comment

    • Sunny

      #3
      RE: Remoting (but need a binary data transfer)

      Hi Jeffrey,
      Thanks a lot for the answer.
      I still have no answer on the question about how the binary data is
      transmitted (I.e. for sure it is some kind of XML), but it is important
      for me to know how exactly look like the the binary stream, because I
      have to transmit something like byte[300000], and ...

      Thanks
      Sunny


      In article <HWRhLeMfDHA.22 64@cpmsftngxa06 .phx.gbl>, v-
      jetan@online.mi crosoft.com says...[color=blue]
      >
      > Hi Sunny,
      >
      > Thank you for posting in this group.
      >
      > You can fulfill you work with .Net Remoting.
      > In the server side, there are 3 ways of creating object for your request:
      > 1.server side activation----singlecall
      > Create object instance for every request
      > 2.server side activation----singleton
      > Create only one instance for all the request.
      > 3.client side activaction
      > Create only one instance for the same client request
      >
      > You can select different server side creation deside by your program logic.
      >
      > Hope this helps
      >
      > Best regards,
      > Jeffrey Tan
      > Microsoft Online Partner Support
      > Get Secure! - www.microsoft.com/security
      > This posting is provided "as is" with no warranties and confers no rights.[/color]


      [color=blue]
      > --------------------
      > | From: Sunny <sunnyask@icebe rgwireless.com>
      > | Subject: Remoting (but need a binary data transfer)
      > | Date: Tue, 16 Sep 2003 15:50:28 -0500
      > | So, can I use all these samples (tutorials, etc.for remoting) to do such
      > | a thing? Is there a problem with the array?
      > | Will it prepare a XML tag for every byte from the array (then the
      > | traffic will be HUGE, and I want to avoid this)?[/color]

      Comment

      • Jeffrey Tan[MSFT]

        #4
        RE: Remoting (but need a binary data transfer)


        Hi Sunny,

        Do you use Marshal by reference or by value?
        I think you should use tcp protocol and binary serialization this object,
        then
        you performance will be better.
        The HTTP will use the SOAP serialization.

        Best regards,
        Jeffrey Tan
        Microsoft Online Partner Support
        Get Secure! - www.microsoft.com/security
        This posting is provided "as is" with no warranties and confers no rights.

        --------------------
        | From: Sunny <sunnyask@icebe rgwireless.com>
        | Subject: RE: Remoting (but need a binary data transfer)
        | Date: Wed, 17 Sep 2003 09:13:19 -0500
        | Message-ID: <MPG.19d227f79d 834cfa989690@ms news.microsoft. com>
        | References: <MPG.19d1339027 4bafd598968f@ms news.microsoft. com>
        <HWRhLeMfDHA.22 64@cpmsftngxa06 .phx.gbl>
        | Organization: Iceberg Wireless LLC
        | MIME-Version: 1.0
        | Content-Type: text/plain; charset="iso-8859-15"
        | Content-Transfer-Encoding: 7bit
        | X-Newsreader: MicroPlanet Gravity v2.60
        | Newsgroups: microsoft.publi c.dotnet.langua ges.csharp
        | NNTP-Posting-Host: 216.17.90.91
        | Lines: 1
        | Path: cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!TK2 MSFTNGP09.phx.g bl
        | Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.langua ges.csharp:1855 02
        | X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.csharp
        |
        | Hi Jeffrey,
        | Thanks a lot for the answer.
        | I still have no answer on the question about how the binary data is
        | transmitted (I.e. for sure it is some kind of XML), but it is important
        | for me to know how exactly look like the the binary stream, because I
        | have to transmit something like byte[300000], and ...
        |
        | Thanks
        | Sunny
        |
        |
        | In article <HWRhLeMfDHA.22 64@cpmsftngxa06 .phx.gbl>, v-
        | jetan@online.mi crosoft.com says...
        | >
        | > Hi Sunny,
        | >
        | > Thank you for posting in this group.
        | >
        | > You can fulfill you work with .Net Remoting.
        | > In the server side, there are 3 ways of creating object for your
        request:
        | > 1.server side activation----singlecall
        | > Create object instance for every request
        | > 2.server side activation----singleton
        | > Create only one instance for all the request.
        | > 3.client side activaction
        | > Create only one instance for the same client request
        | >
        | > You can select different server side creation deside by your program
        logic.
        | >
        | > Hope this helps
        | >
        | > Best regards,
        | > Jeffrey Tan
        | > Microsoft Online Partner Support
        | > Get Secure! - www.microsoft.com/security
        | > This posting is provided "as is" with no warranties and confers no
        rights.
        |
        |
        |
        | > --------------------
        | > | From: Sunny <sunnyask@icebe rgwireless.com>
        | > | Subject: Remoting (but need a binary data transfer)
        | > | Date: Tue, 16 Sep 2003 15:50:28 -0500
        | > | So, can I use all these samples (tutorials, etc.for remoting) to do
        such
        | > | a thing? Is there a problem with the array?
        | > | Will it prepare a XML tag for every byte from the array (then the
        | > | traffic will be HUGE, and I want to avoid this)?
        |

        Comment

        Working...