Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7905071
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T10:19:36+00:00 2026-06-03T10:19:36+00:00

I am new to objective C and I need to send a simple message

  • 0

I am new to objective C and I need to send a simple message via UDP. The server part is working cause it is implemented in C#.

The server code in C# is:

 var server = new UdpClient(8585);
 var groupEP = new IPEndPoint(IPAddress.Parse("192.168.0.120"),8585);
 byte[] bytes = server.Receive(ref groupEP);

and the client part in c# is:

   System.Net.Sockets.UdpClient client;     
client = new System.Net.Sockets.UdpClient("192.168.0.120",8585);    
client.Send(new byte[]{1,2,3,4},4);

how can I do the same client part in objective c? I know there are a lot of tutorials on the internet such as this library. when I import that library to my project I do not know how to instantiate a new object. I have tried:

 [[GCDAsyncUdpSocket alloc] initWithSocketQueue:... ??? I don't know how to initialize it.

I will appreciate if someone can show me a simple example of how could I replicate the client part into objective c.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T10:19:37+00:00Added an answer on June 3, 2026 at 10:19 am

    download GCDAsyncUdpSocket from here. then you may send packets as:

     GCDAsyncUdpSocket *udpSocket ; // create this first part as a global variable
     udpSocket = [[GCDAsyncUdpSocket alloc] initWithDelegate:self delegateQueue:dispatch_get_main_queue()];
    
     NSData *data = [ 
                       [NSString stringWithFormat:@"%Hello Wold" 
                        dataUsingEncoding:NSUTF8StringEncoding
                    ];
    
    [udpSocket sendData:data toHost:@"192.168.10.111" port:550 withTimeout:-1 tag:1];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just need to send a basic message with via UDP. I already gave
I'm new with Objective-C, i'm working in an application and I need to connect
I need just a simple Objective-C app or API that can send and receive
I am new to Objective-C and i need your help! In the code that
I pretty new to Objective-C (and C itself) and need to consume a NSData
New to Cocoa and Objective-c. Do I need getters and setters if I'm depending
I am new to Objective-C and I have no clue why this code is
I'm very much new to objective C. I have a case where I need
Completely new to Objective-C, trying to find out when I need to alloc and
Very new to Objective-C and Xcode and working my way through modifying the DrillDownApp

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.