|
shah123 wrote: What can be the reason
I don't see anywhere in your server code where you setup the Tcp Channel that you are trying to use in the client.
|
|
|
|
|
Sorry it was in Server Form_Load method.
<br />
private void Form1_Load(object sender, EventArgs e)<br />
{<br />
<br />
TcpServerChannel tsc = new TcpServerChannel(8080);<br />
ChannelServices.RegisterChannel(tsc);<br />
RemotingConfiguration.RegisterWellKnownServiceType(typeof(CustServer), "CUSTOMER_SERVER2", WellKnownObjectMode.Singleton);<br />
textBox1.Text = "SERVER RUNNING ..";<br />
textBox1.ReadOnly=true;<br />
<br />
}
|
|
|
|
|
shah123 wrote: DeptInterface
I don't think you can register a "CustServer" and then in the client Activate a "DeptInterface".
Also with Remoting, I recommend using namespaces.
|
|
|
|
|
so please tell me the way... I will be very thankful to you.
|
|
|
|
|
It has been awhile since I've done remoting....but you cannot run a server as a windows form. That is just not right. For a good primer, Ingo Ramer has a great book on remoting that will help you through your problems of creating a great server. Also if you google for remoting you can also find some examples.
My services always ran under IIS so that allowed the IIS host to handle all of the connection issues and my classes existed as a service within the web server.
However, the long term direction of Microsoft is to eliminate .NET Remoting so if it is at all possible you should move to using WCF instead for you deployment.
|
|
|
|
|
Hey Thanks for ur replies....i really appreciate...but I think developing a parser or lexical analyser will be a complex task, My project just needs to provide a SQL syntax checking as a feature...so can we have a simpler approach?
|
|
|
|
|
hello iam a fresher
my problem is if i click previous button first time it is going to next question after clicks the previous button it is going to previous question . for example at 8th question i clicks on previous button it is going to 9th question then second time i clicks on previous button it is going to 8 th question then 7th then 6th then 5th...........
<pre>
{
if(dg1.CurrentPageIndex < 1 )
return;
else
if (dg1.CurrentPageIndex > 0)
{
dg1.CurrentPageIndex -= 1;
SwitchLebel(dg1.CurrentPageIndex);
}
is it correct or not
srinivas
|
|
|
|
|
srinivassam wrote: is it correct or not
Probably not, since you dont like the results.
Show more actual code to help us help you...
|
|
|
|
|
I have the following list:
System.Collections.Generic.List<Employee> employees= new System.Collections.Generic.List<Employee>();
Employee class has the following fields(for simplicity):
EmployeeId
EmployeeName
Department
JobTitle
etc.
I want that the new employee instance can be added employees list only if the list does not already contain it. I think the Exists() method may be used for this checking. But i dont know how use it.
Kindly, give me articles' and examples' links to understand the usage.
Thanks!.
|
|
|
|
|
MSDN has nice examples about that. Exists allows you to determine if list contains an element that matches a specified search pattern. Contains method tell if an element is in list
|
|
|
|
|
Thanks!.
But i wana understand the use of Predicate with custom objects rather than premitive type in Exits() method.
Thanks once again!.
|
|
|
|
|
lossy wrote: I want that the new employee instance can be added employees list only if the list does not already contain it. I think the Exists() method may be used for this checking. But i dont know how use it.
Kindly, give me articles' and examples' links to understand the usage.
Have you considered reading the documentation? What does it say about its use?
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
* Reading: Developer Day 5
Ready to Give up - Your help will be much appreciated.
My website
|
|
|
|
|
Determines whether the List contains elements that match the conditions defined by the specified predicate.
(from MSDN)
|
|
|
|
|
|
Hi
The following code declare the predicate match method in the employee class.
in order to check if employee instance exists within the list, just construct new employee class with the relevant parameters (i used id as key) and call the Exists method
class Program
{
class Employee
{
private long m_id;
public Employee(long id)
{
m_id = id;
}
public bool IsMatch(Employee employee)
{
return (m_id == employee.m_id);
}
};
static void Main(string[] args)
{
List<employee> employees = new List<employee>();
employees.Add(new Employee(1));
employees.Add(new Employee(2));
employees.Add(new Employee(3));
employees.Add(new Employee(4));
employees.Add(new Employee(5));
Console.WriteLine(employees.Exists(new Employee(3).IsMatch) != null);
}
}
|
|
|
|
|
Thanks!. for alternative solution.
|
|
|
|
|
Hi,
I have a problem in that I have a function as follows:
public void Init()<br />
{<br />
DoSomething();<br />
DoSomethingElse();<br />
<br />
MyObject obj = new MyObject();<br />
obj.Var1 = "Test";<br />
obj.Var2 = 123;<br />
}<br />
Now when I step through the code it stops debugging at the point of entering Init() in the calling event. By stops debugging I mean all execution appears to stop and it hangs, it does not even step into the Init() function but if I remove the '= new Object()' it will step into the function and execute the two top methods before giving a NullReferenceException as you would expect.
So my question is; what make the creation of a new object stop the entire enclosing method from executing?
|
|
|
|
|
Hi DanC,
Is MyObject a class(public or private) and Var1 and Var2 are class variables that u r accessing with the object instance of that class ? If that is so, then I would say the code ideally works fine, it steps into the function when called by an event lets say button click, this is what i wrote
<br />
private void button2_Click(object sender, EventArgs e)<br />
{<br />
Init(); <br />
}<br />
public class MyObject<br />
{<br />
public string Var1;<br />
public int Var2;<br />
}<br />
public void Init()<br />
{<br />
MyObject obj= new MyObject();<br />
obj.Var1 = "Test";<br />
obj.Var2 = 123;<br />
}<br />
and it is running fine, I think the execution on ur side is exiting the application, try and analyse the code further and let me know
|
|
|
|
|
MyObject is a public class from an external class library, I am setting both vars and adding event delegates in the Init() function. I am executing it as you describe above but it will only step in if the 'new MyObject()' line is not there.
With the line 'MyObject obj = new MyObject()' in the code when I step into that function all debug buttons are greyed out apart from stop, pause and restart and it does not step into the function, however if I comment out the ' = new MyObject()' it does step into the function and executes the DoSomething() and DoSomethingElse().
I do not change anything other than commenting out the ' = new MyObject()' to make it step into the code.
|
|
|
|
|
Hi,
who is calling Init ? some constructor ?
is it a first time call ?
has MyObject class already been called (hence compiled by JIT) ?
Any chance MyObject can not be found at run-time (separate DLL maybe ?).
Please show code for MyObject (at least: members and constructor).
|
|
|
|
|
Init is being called by the Start event of the main class for the app.
It is a first time call.
MyObject has not been called before but I have left the app for 10 mins and it is still hung so I would think it unlikely it was the JIT compiler.
I would expect to see an exception if the class could not be found rather than the app hanging but the class is in a referenced DLL next to the app.
I cannot show the code for MyObject as it is a third-party .NET assembly.
|
|
|
|
|
Hi
did you try using a try / catch block in order to catch exception ???
|
|
|
|
|
I have a try...catch block inside the Init() function to catch the exception but the problem is that the execution does not enter the Init() functio if that line exists so therefore no exception is thrown.
|
|
|
|
|
use the try catch before the call to the init function
|
|
|
|
|
I should have mentioned, I have also wrapped the Init() in a try...catch but again, nothing, no exception, nothing, just a hung application.
|
|
|
|