Remoting (but need a binary data transfer)

S

Sunny

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(username, 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(string u, string p)
{ ... }
}


//client


MyWorkClass myServer = new MyWorkClass();
// subscribe event handler
myServer.I_AM_Ready += ....
if (myServer.Connect(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
 
J

Jeffrey Tan[MSFT]

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 <[email protected]>
| Subject: Remoting (but need a binary data transfer)
| Date: Tue, 16 Sep 2003 15:50:28 -0500
| Message-ID: <[email protected]>
| 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.public.dotnet.languages.csharp
| NNTP-Posting-Host: 216.17.90.91
| Lines: 1
| Path:
cpmsftngxa07.phx.gbl!cpmsftngxa10.phx.gbl!TK2MSFTNGXA05.phx.gbl!TK2MSFTNGP08
.phx.gbl!TK2MSFTNGP12.phx.gbl
| Xref: cpmsftngxa07.phx.gbl microsoft.public.dotnet.languages.csharp:184665
| X-Tomcat-NG: microsoft.public.dotnet.languages.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(username, 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(string u, string p)
| { ... }
| }
|
|
| //client
|
|
| MyWorkClass myServer = new MyWorkClass();
| // subscribe event handler
| myServer.I_AM_Ready += ....
| if (myServer.Connect(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
|
 
S

Sunny

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
 
J

Jeffrey Tan[MSFT]

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 <[email protected]>
| Subject: RE: Remoting (but need a binary data transfer)
| Date: Wed, 17 Sep 2003 09:13:19 -0500
| Message-ID: <[email protected]>
| References: <[email protected]>
<[email protected]>
| 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.public.dotnet.languages.csharp
| NNTP-Posting-Host: 216.17.90.91
| Lines: 1
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:185502
| X-Tomcat-NG: microsoft.public.dotnet.languages.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 <[email protected]>, v-
| (e-mail address removed) 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 <[email protected]>
| > | 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)?
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top