void RegFileSearchp2pClient(string P2PUri)
        {
            try
            {
                NetPeerClient npcDummyFileSearch = new NetPeerClient();
                objNetTcpFileSearch = new clsNetTcpFileSearch();
                ((clsNetTcpFileSearch)objNetTcpFileSearch).EntsvcJoin += new clsNetTcpFileSearch.delsvcJoin(P2PFileSearchClient_EntsvcJoin);
                ((clsNetTcpFileSearch)objNetTcpFileSearch).EntsvcUnJoin += new clsNetTcpFileSearch.delsvcUnJoin(P2PFileSearchClient_EntsvcUnJoin);
                channelNettcpFileTransfer = (IFileTransferChannel)npcDummyFileSearch.OpenClient<IFileTransferChannel>(P2PUri, P2PUri.ToString().Split(':')[2].Split('/')[2], ref objNetTcpFileSearch);

                while (tempcounter < 20)
                {
                    try
                    {
                        channelNettcpFileTransfer.svcJoin(UserName);
                        tempcounter = 20;
                    }
                    catch
                    {
                        tempcounter++;
                        System.Threading.Thread.Sleep(1000);
                    }
                }
            }
            catch (Exception exp)
            {
                VMuktiAPI.VMuktiHelper.ExceptionHandler(exp, "RegFileSearchp2pClient", "P2PFileSearchClient.cs");               
            }
        }
예제 #2
0
        void RegNetP2PClient(object netP2pUri)
        {
            try
            {
                NetPeerClient npcDummyFileSearch = new NetPeerClient();
                objNetFileSearch = new clsNetTcpFileSearch();
                ((clsNetTcpFileSearch)objNetFileSearch).EntsvcJoin += new clsNetTcpFileSearch.delsvcJoin(FileSearchDummy_EntsvcJoin);
                ((clsNetTcpFileSearch)objNetFileSearch).EntsvcRequestFile += new clsNetTcpFileSearch.delsvcRequestFile(FileSearchDummy_EntsvcRequestFile);
                ((clsNetTcpFileSearch)objNetFileSearch).EntsvcSearchQuery += new clsNetTcpFileSearch.delsvcSearchQuery(FileSearchDummy_EntsvcSearchQuery);
                ((clsNetTcpFileSearch)objNetFileSearch).EntsvcSearchResult += new clsNetTcpFileSearch.delsvcSearchResult(FileSearchDummy_EntsvcSearchResult);
                ((clsNetTcpFileSearch)objNetFileSearch).EntsvcSendFileBlock += new clsNetTcpFileSearch.delsvcSendFileBlock(FileSearchDummy_EntsvcSendFileBlock);
                ((clsNetTcpFileSearch)objNetFileSearch).EntsvcGetUserList += new clsNetTcpFileSearch.delsvcGetUserList(FileSearchDummy_EntsvcGetUserList);
                ((clsNetTcpFileSearch)objNetFileSearch).EntsvcSetUserList += new clsNetTcpFileSearch.delsvcSetUserList(FileSearchDummy_EntsvcSetUserList);
                ((clsNetTcpFileSearch)objNetFileSearch).EntsvcUnJoin += new clsNetTcpFileSearch.delsvcUnJoin(FileSearchDummy_EntsvcUnJoin);
                NetP2PChannel = (IFileTransferChannel)npcDummyFileSearch.OpenClient<IFileTransferChannel>(netP2pUri.ToString(), netP2pUri.ToString().Split(':')[2].Split('/')[2], ref objNetFileSearch);

                while (tempcounter < 20)
                {
                    try
                    {
                        NetP2PChannel.svcJoin(UserName);
                        tempcounter = 20;
                    }
                    catch
                    {
                        tempcounter++;
                        System.Threading.Thread.Sleep(1000);
                    }
                }
            }
            catch (Exception ex)
            {
                VMuktiAPI.VMuktiHelper.ExceptionHandler(ex, "RegNetP2PClient", "FileSearchDummy.cs");               
            }
        }