DevPinoy.org
A Filipino Developers Community

>>> First two to make 3 wins! <<<

How to send dataset through network

rated by 0 users
This post has 8 Replies | 0 Followers

Top 25 Contributor
Posts 83
Points 1,560
romcab Posted: 04-10-2008 10:08 PM

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. 

  • | Post Points: 20
Top 25 Contributor
Posts 88
Points 1,240

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? 

Jon Limjap tech :: DotNet @ Kape ni LaTtEX personal :: Kape ni LaTtEX our business: I-NAV Travel & Tours
  • | Post Points: 35
Top 10 Contributor
Posts 953
Points 22,750

i'd rather not use a dataset for this...heavy!

http://devpinoy.org/blogs/cruizer
Naglalayong buksan at palayain ang kamalayan ng Pinoy .NET developer
  • | Post Points: 5
Top 25 Contributor
Posts 83
Points 1,560

 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.

  • | Post Points: 20
Top 25 Contributor
Posts 88
Points 1,240
No need. Just as long as you can connect remotely to your database, you can use that for your application as is. No need to serialize/deserialize into XML.
Jon Limjap tech :: DotNet @ Kape ni LaTtEX personal :: Kape ni LaTtEX our business: I-NAV Travel & Tours
  • | Post Points: 20
Top 25 Contributor
Posts 83
Points 1,560

 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. 

  • | Post Points: 20
Top 10 Contributor
Posts 953
Points 22,750

easiest way to do this is via ASP.NET web services, or WCF (for .NET 3.0 and newer)

http://devpinoy.org/blogs/cruizer
Naglalayong buksan at palayain ang kamalayan ng Pinoy .NET developer
  • | Post Points: 20
Top 25 Contributor
Posts 83
Points 1,560

 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? 

  • | Post Points: 20
Top 50 Contributor
Posts 60
Points 915

 
I dont have any idea how did you implement your listener or acceptor, but
whether 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 and
you can send and receive data from that client. Wink


http://dexterz.spaces.live.com/     |    http://projectzgdk.spaces.live.com/

 

  • | Post Points: 5
Page 1 of 1 (9 items) | RSS

Copyright DevPinoy 2005-2008