Results 1 to 5 of 5

Thread: [RESOLVED] [2005] Networking without a server(UDP?)

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2007
    Posts
    87

    Resolved [RESOLVED] [2005] Networking without a server(UDP?)

    I am creating a program that uses a MySql database server(on a ubuntu/linux OS) to reduce the cost of the program.

    To prevent that people gonna edit the same record i first wanted to create a service that monitors wich client is busy with what record and the clients will ask 'premisison' from the service trought TCP/IP. But i cant install .NET services on a linux server. So there starts my problem.

    For me no problem to create TCP/IP apps but i never created UDP apps.
    They both use system.net.sockets.socket as client and are quite similar besides that they dont have to connect to a server/listner.

    With that in mind i thought i could just send out data over a port and let a UDP client recieve it. However when i want to send something it says it needs a connected socket to send to.

    The idea was to just send somedata over the network and if someone has the program running, it recieves the message and then a lot of other stuff like sending back bla bla bla.

    But now i know i need an IP or DNS too my idea`s stop.
    Cause i dont know wich of 100 pc`s are running my program and i have to connect to.

    Is there any way to scan the network or something like that.

    Maybe my story is a bit vague but i hope someone can help


    Greets

  2. #2
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,106

    Re: [2005] Networking without a server(UDP?)

    Take a look at the UDP threads I have in the networking section. Just a few minutes back I posted a UDP class that probably does more than what you want, but the constructor, in particular, will give you some ideas.

    The problem I was trying to solve with the class I posted was that I have one to many programs running on several different computers on a LAN. All of them need to communicate, and be aware of any other messages sent by others. Therefore, each program broadcasts its messages with a byte to indicate who it was from, a byte to indicate who should receive it (0 means everybody, but anybody can receive any packet they feel like), and a byte to indicate the type of message. The reason for that last part is because I am sending binary serialized structures, so the receiver needs to know what to deserialize the bytes back into.

    The class is currently working and tested.

    Keep in mind that with UDP, a packet may get lost, which is unlike TCP. You should keep packet size quite small, and if it is absolutely critical that a message gets through, you will need to have the receiver echo something back to the sender (in some cases I have just echoed the same message back, but if you are broadcasting, you'll need to include the sender in the message). The sender in this case will have to keep sending periodically until it gets a receipt back from the receiver.
    My usual boring signature: Nothing

  3. #3

    Thread Starter
    Lively Member
    Join Date
    May 2007
    Posts
    87

    Re: [2005] Networking without a server(UDP?)

    Aaah thnx ill take a look @ it.

    Maybe a better explanation of what is want:

    Its a bit the as iTunes uses. When someone in your network starts iTunes you see that that libairy 2.
    Thats something i want to achive .

    Greets

  4. #4
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,106

    Re: [2005] Networking without a server(UDP?)

    That's an example that's lost on me. I've never used iTunes.
    My usual boring signature: Nothing

  5. #5

    Thread Starter
    Lively Member
    Join Date
    May 2007
    Posts
    87

    Re: [2005] Networking without a server(UDP?)

    Got it working with your code .

    Thnx alot

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width