जैसा कि अन्य ने कहा है, यदि आप चैनल का नाम निर्दिष्ट नहीं करते हैं, तो डिफ़ॉल्ट रूप से कोड "टीसीपी" का उपयोग करता है और प्रत्येक चैनल के पास एक अद्वितीय नाम होना चाहिए: इसलिए आपके द्वारा खोले जाने वाले प्रत्येक चैनल के लिए एक अद्वितीय नाम निर्दिष्ट करें ...
int tcpPort = 52131;
// ------------------------------------------------------------
BinaryServerFormatterSinkProvider serverProv =
new BinaryServerFormatterSinkProvider();
serverProv.TypeFilterLevel = TypeFilterLevel.Full;
RemotingConfiguration.CustomErrorsMode = CustomErrorsModes.Off;
serverProv.TypeFilterLevel = TypeFilterLevel.Full;
IDictionary propBag = new Hashtable();
// -----------------------------------------
bool isSecure = [true/false];
propBag["port"] = tcpPort ;
propBag["typeFilterLevel"] = TypeFilterLevel.Full;
propBag["name"] = "UniqueChannelName"; // here enter unique channel name
if (isSecure) // if you want remoting comm to be secure and encrypted
{
propBag["secure"] = isSecure;
propBag["impersonate"] = false; // change to true to do impersonation
}
// -----------------------------------------
tcpChan = new TcpChannel(
propBag, null, serverProv);
ChannelServices.RegisterChannel(tcpChan, isSecure);
// --------------------------------------------
string uRI = MyUniversalResourceIndicatorName;
// ---------------------------------------------
RemotingConfiguration.RegisterWellKnownServiceType(
typeof(ImportServiceManager), uRI ,
WellKnownObjectMode.SingleCall);
स्रोत
2009-05-08 13:49:08
में सर्वर/क्लाइंट चाहता हूं पोर्ट बंदरगाह हैं तरंग .. –
@ खुर्रम अज़ीज़ - तो प्रत्येक उदाहरण अलग-अलग बंदरगाहों को खोलता है (प्रत्येक उदाहरण के बजाय एकाधिक बंदरगाह खुलता है, लेकिन अलग-अलग उपयोग करता है)? – stevehipwell
@ खुर्रम अज़ीज़ - क्या आपके पास अलग-अलग नामों का उपयोग करके दोनों चैनल हैं? – stevehipwell