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 8598901
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T01:16:06+00:00 2026-06-12T01:16:06+00:00

After reading several tutorials I came up with the following code: (Using the famous

  • 0

After reading several tutorials I came up with the following code:
(Using the famous GCDAsyncUdpSocket class)

NSError *error = nil;

if (![mSocket connectToHost:@"192.168.1.111" onPort:9050 error:&error])
{
    NSLog(@"Error connecting: %@", [error description]);
}

usleep(100000);

NSString* str = @"teststring";
[mSocket sendData:[str dataUsingEncoding:NSUTF8StringEncoding] toHost:@"192.168.1.111" port:9050 withTimeout:-1 tag:1];

If I run this code on my iPhone everything seems fine (no errors).
But the packet never arrives on my PC.

On my PC a UDP listener is running (alongside with Wireshark). Both devices are on the same network with the same subnet and similar IPs (my PC is 192.168.1.111). Am I doing something wrong? A simple mistake hopefully?

  • 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-12T01:16:07+00:00Added an answer on June 12, 2026 at 1:16 am

    The methods

    sendData:toHost:port:withTimeout:tag:
    sendData:toAddress:withTimeout:tag:
    

    are for sending messages with unconnected sockets, so you should not call connectToHost. For a connected host, you can use

    sendData:withTimeout:tag:
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created my first project (after several tutorials and reading the Android Developers
after reading several tutorials (e.g. ocpsoft , oracle ) I started to use embedded
After several days of reading tutorials and searching The Google I have hit a
After reading several articles of a hierarchical data tables, I've made my way into
After reading several questions regarding problems with compilation (particularly C++) and noticing that in
After reading several posts on this matter, I thought I was all clear about
after a lot of googling and reading several solutions on how to manage mixed
I have been reading several tutorials and watching some iTube videos to see how
I notice this has caused confusion for several people, but after reading a couple
At some point through my error my localhost started getting redirected. After reading around

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.