c# - .NET Remoting convention -


i have server-side code using .net remoting establish connection client. normally, understand using interfaces objects passed between client , server norm , safer alternative, simple communication establishing, not see need go through trouble of defining necessary classes , interfaces.

so following code, since i'm returning string client, don't feel necessity might otherwise i'm posting question here. should follow general convention or stick way i'm doing? code shown below correct way of establishing server remoting?

(don't ask why i'm using remoting instead of wcf. boss requested remoting , don't know why.)

class httpserver {      [stathread]     public static boolean startservice()     {         httpchannel channel = new httpchannel(80);          channelservices.registerchannel(channel);         type ddcservertype = type.gettype("ddcengine.ddcserver");         remotingconfiguration.registerwellknownservicetype(ddcservertype, "ddcserver", wellknownobjectmode.singleton);         return true;     } }  public class ddcserver : marshalbyrefobject {     public string hello()     {         string r = "hello";         return r;     }      [description("sets new io point list in ddc.")]     public string setiopointlist(string host, ddcservice.pointinformation[] pointlist)     {          string result;          ddcservice.lgeddcclient ddc = new ddcservice.lgeddcclient("lgeddc", host);          try         {             result = ddc.setiopoint(pointlist);         }         catch (exception ex)         {             result = ex.tostring();         }         return result;     } 

the problem not using interface need include server code on client. that's not issue simple this, can real problem if server interface becomes more complicated or server implementation involved.

this becomes of deployment problem, too. time change in server implementation, have copy new server implementation clients. if you're using interface, time have update clients if change interface. server implementation changes don't affect clients. @ least, don't affect way clients interact server.

this can cause security problem. if there proprietary information in server code, code exposed on every client. if use interface, there's no need include server code.

it might easier front avoid defining interface server. in long run, using interface more secure, easier modify, , easier deploy--especially when there multiple clients.

all said, should ask boss why asked remoting. read on differences between wcf , remoting before do. wcf more robust technology.


Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -