Thread: sending matrix over UDP socket

  1. #1
    Registered User
    Join Date
    Feb 2014
    Posts
    7

    sending matrix over UDP socket

    Hi,

    I want to apply program to send matrix from client and server ,and return back a processed matrix ..

    How I can do it using UDP ,it was easy to use tcp for that!?

    Thanks,

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Why would it make any difference to you?

    You still have to create a message block containing the data you want to send, and you still have to call send() / recv() (oh ok, sendto() and recvfrom()), to transfer it.

    The problems you have to look out for are:
    - UDP is unreliable, you may not get the block you sent.
    - UDP packets may arrive in a different order (to the order they were sent in).
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Feb 2014
    Posts
    7
    Quote Originally Posted by Salem View Post
    Why would it make any difference to you?

    You still have to create a message block containing the data you want to send, and you still have to call send() / recv() (oh ok, sendto() and recvfrom()), to transfer it.

    The problems you have to look out for are:
    - UDP is unreliable, you may not get the block you sent.
    - UDP packets may arrive in a different order (to the order they were sent in).

    Hi Salem,
    Thanks for your response!

    I want to use UDP ,and get results the way as TCP - For example when I run the code in the server ,it started directly without waiting to get data from the client!?
    How I can do the synchronization between the client & server using UDP ?

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    > it started directly without waiting to get data from the client!?
    You look at the return result of recvfrom() to make sure you have some data.

    Without you posting the code, this is all just wild guesswork and frankly a waste of time.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Socket Overflow by sending / receiving ACK's
    By MaSSaSLaYeR in forum C Programming
    Replies: 13
    Last Post: 11-24-2011, 02:38 AM
  2. Sending TCP ACK + Bytesize (Socket Programming)
    By MaSSaSLaYeR in forum C Programming
    Replies: 9
    Last Post: 11-24-2011, 02:35 AM
  3. Sending null-bytes over a socket?
    By Siphon in forum C Programming
    Replies: 2
    Last Post: 10-08-2007, 03:21 PM
  4. sending in socket
    By fairyjerry14 in forum C Programming
    Replies: 4
    Last Post: 10-08-2007, 07:11 AM
  5. sending zero bytes over TCP socket
    By nantonop in forum Networking/Device Communication
    Replies: 4
    Last Post: 09-03-2007, 08:10 AM

Tags for this Thread