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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T14:48:49+00:00 2026-05-12T14:48:49+00:00

To avoid relying on the wireless tools I want to get the essid directly

  • 0

To avoid relying on the wireless tools I want to get the essid directly from the device with ioctl, in C this wouldn’t be a problem, but in Ruby it’s quite different.

The problem is following struct from wireless.h that is used as input/reply of ioctl:

struct  iw_point
{
  void __user *pointer; /* Pointer to the data  (in user space) */
  __u16   length;   /* number of fields or size in bytes */
  __u16   flags;    /* Optional params */
};

The pointer part must be a valid address of a memory area, followed by the length in bytes, followed by a flag field. I tried with Array#pack and the bit-struct gem, but haven’t found a solution yet.

Is there a way to bypass this memory pointer problem?

  • 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-05-12T14:48:49+00:00Added an answer on May 12, 2026 at 2:48 pm

    I finally got it working, the solution was to use the ‘p’ argument of pack in this way:

    require "socket"
    
    # Copied from wireless.h
    SIOCGIWESSID      = 0x8B1B
    IW_ESSID_MAX_SIZE = 32
    
    iwreq = [ "wlan0", " " * IW_ESSID_MAX_SIZE, IW_ESSID_MAX_SIZE, 0 ].pack("a16pII")
    
    sock = Socket.new(Socket::AF_INET, Socket::SOCK_DGRAM, 0)
    
    sock.ioctl(SIOCGIWESSID, iwreq)
    
    interface, essid, len, flags = iwreq.unpack("a16pII")
    
    puts essid
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'd like to avoid this scary messages when users install my application: I understand
How can I avoid NullPointerExceptions ? I have tried using try-catch blocks but that
Also trying to avoid any use of plugins, (apart from jQuery of course, whether
To avoid the high latency (spikes) in GAE datastore writes, I want to implement
Yes, the title is confusing, but I will keep this simple. Imagine a photo
I want to avoid spammers putting advertisements and curses [into a forum]. What is
I have a menu which looks like this: |Home|Options|Settings|Tools|Preferences|Edit| That's fine when a phone
How can I avoid field from being serialized? I use xml attributes. Currently field
Avoid default quotes from csv using fputcsv fputcsv($fp, $array, ',', ''); // OR fputcsv($fp,
For avoid repeating i want a function use in several ajax call. how is

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.