Hi guys,
I have a simple client/server apps created in C#. The server apps is connected to a database server. What I want to do is that when the client connect to the server, the server will send the database content to the client. The client will then display the content on the screen. What I can think right now is to convert database contents to xml then send the xml to the network but I'm not sure if it will work. Hope you can give me any suggestion and links so I can easily understand.
I dunno why you have to do that. Even if a database server is across the globe, .NET will receive the data automatically without need for XML serialization.
If you are using remoting, or web services, XML serialization is automatic as long as your data is in the form of serializable objects
Paano ba ang setup ng app mo?
i'd rather not use a dataset for this...heavy!
Hi. I'm not using remoting or web services. The requirement is just, when the client connect to the server, the server just needs to send the content of the database. The client will then display it on the screen. Do I need to use remoting or web services for that? Hope you can give me a good idea, i'm just a beginner in C# and database. Thanks again.
Hi pal,
I think I cannot remotely connect to the database since it is local only to the server apps. That's why I need to find a way on how to send the content from server to client.
easiest way to do this is via ASP.NET web services, or WCF (for .NET 3.0 and newer)
Hi,
Right now I have an idea to solve this problem. My new problem right now is how to create a manager which handles all the connection. I need to save the thread i and ip address of the client who will connect to the server. I have no idea how to get the client IP address using Tcpclient and TcpListener class. Is there a class that I can use to do that?
I dont have any idea how did you implement your listener or acceptor, butwhether you are using a seperate thread to accept connection by invoking _TcpListener.AcceptSocket(...) or calling an asyncronous callback by invoking _TcpListener.BeginAcceptSocket(...) both methods returns new client connecting socket. For thread: m_NewClienConnectiontSocket = _TcpListener.AcceptSocket(); // yourClientManager.AddClient( m_NewClientConnectionSocket ); For async callback: m_NewClientConnectionSocket = _TcpListener.EndAcceptSocket( result ); // yourClientManager.AddClient( m_NewClientConnectionSocket ); Just push m_NewClientConnectionSocket to your client manager list or collection andyou can send and receive data from that client.
http://dexterz.spaces.live.com/ | http://projectzgdk.spaces.live.com/