3 Replies - 698 Views - Last Post: 06 October 2011 - 08:32 AM Rate Topic: -----

#1 Sayuri0903  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 37
  • Joined: 14-May 10

Problem: How to sent and received object with Client Server

Posted 06 October 2011 - 08:12 AM

I'm doing my assignment.
It's a small Sudoku game, allow 2 people play together. One wills host and one will join into host's room.

However, I don't have any experience about sent and received object with client server.

Where should I begin? or How can I do?
Have any tutorial about that?

Plz help me :((

Is This A Good Question/Topic? 0
  • +

Replies To: Problem: How to sent and received object with Client Server

#2 Curtis Rutland  Icon User is offline

  • (╯□)╯︵ (~ .o.)~
  • member icon


Reputation: 5101
  • View blog
  • Posts: 9,283
  • Joined: 08-June 10

Re: Problem: How to sent and received object with Client Server

Posted 06 October 2011 - 08:17 AM

Start by searching "C# TCP" on google or any other search engine. You'll find tutorials:

http://www.switchont...aded-tcp-server
Was This Post Helpful? 1
  • +
  • -

#3 Sayuri0903  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 37
  • Joined: 14-May 10

Re: Problem: How to sent and received object with Client Server

Posted 06 October 2011 - 08:27 AM

Thanks, that's good help.
But I need to know how to sent and received an object, such as Person...
Was This Post Helpful? 0
  • +
  • -

#4 Curtis Rutland  Icon User is offline

  • (╯□)╯︵ (~ .o.)~
  • member icon


Reputation: 5101
  • View blog
  • Posts: 9,283
  • Joined: 08-June 10

Re: Problem: How to sent and received object with Client Server

Posted 06 October 2011 - 08:32 AM

For that, you can do one of two things: Serialization, or a bastardized form of serialization, in which you just send simple strings that can represent your objects.

You can't just dump an object through TCP. You have to find some way to represent it as a stream of bytes. This is entirely possible via Binary Serialization, but it's a little advanced for someone in a college class doing homework.

Alternatively, you can send messages thatrepresent a Person. If a Person has a FirstName, LastName, and HighScore, you can write a method that will mix those values together, perhaps like this:

"Curtis|Rutland|9001"

And then a method that will take such a string, break it apart, and create a new Person from it.

Hope that helps. From here on out, you'll actually have to show effort to get help. Please post code next time.
Was This Post Helpful? 2
  • +
  • -

Page 1 of 1