UNIX Socket FAQ

A forum for questions and answers about network programming on Linux and all other Unix-like systems

You are not logged in.

#1 2013-10-24 10:18 AM

RipRage
Member
From: England
Registered: 2010-01-06
Posts: 146

Linux

Random one, I've fallen in love with Linux: Luna! What a beautiful distro! Yeah I know it's not your "I want to configure the living shit out of everything!" Type distro by why should it be!? I can see myself replacing windows with this eventually, what do you guys use?

Offline

#2 2013-10-24 12:07 PM

RobSeace
Administrator
From: Boston, MA
Registered: 2002-06-12
Posts: 3,847
Website

Re: Linux

Huh, I've never even heard of Luna before...

I've pretty much been a Red Hat user forever...  In the early days, we used Slackware on a couple servers, but since then it's been Red Hat all the way...  These days that comes in the form of CentOS, since we're not rich/crazy enough to pay for official RHEL support... ;-)  But, I mainly only run CentOS on my personal workstation due to the fact I need to write code to run on CentOS servers at work, so it makes things easier to be able to get things up and running here in the same environment...  Otherwise, I'd probably run a more modern desktop-friendly distro like Fedora or maybe even Ubuntu...  (Though, the only reason I'd consider Ubuntu is because it was the recommended distro for use with Valve's Steam Linux client and their games...  Though, these days I think it works on most modern distros...  Plus, they're releasing their own custom distro called SteamOS sometime soon...  Though, really, before even thinking about gaming, I'd really need a new, faster PC, because my current one is getting pretty ancient...)

I dropped all MS ties not long after Win95 came out!  I used to be a fairly happy DOS user, but absolutely loathed Windows and the general direction MS was heading...  As soon as id got QuakeWorld running on Linux and announced that Quake 2 and 3 would definitely be released on Linux, that was all the push I needed to dump Windows and install Linux (I think it was Red Hat 5, at the time; not RHEL5 mind you, but old school RH personal edition 5)...  Yes, I've always been somewhat driven by gaming when it comes to my computer... ;-)  Though, these days, pretty much the only gaming I really do anymore is on my Xbox360...  So, I guess MS still has their hooks in me via that!  But, as long as I don't have to use it for doing any real work or really anything but gaming, I can tolerate it...  (Though, next console cycle, I'm probably going PS4 over XB1...  Or, maybe some SteamOS-based console if they release a decent one!)

Offline

#3 2013-10-24 09:36 PM

i3839
Oddministrator
From: Amsterdam
Registered: 2003-06-07
Posts: 2,239

Re: Linux

Your distro is probably "elementary OS", a Ubuntu spin-off. "Luna" is the code name of your current version.

What I loved about Linux when I first discovered it was that you could see what was happening and how it worked, you could poke at it, look into the source, and be generally close to the system without a big blob of crappy software standing in the way. I've tried many distro's, but mostly I've used Gentoo in the early days and Arch Linux the longest, up to today (although I hate they've switched to systemd). I have customised my laptop system quite a bit: Self compiled kernel with some patches, a custom init system, self compiled Fluxbox with my own modifications, and static /dev/ with no udev/systemd. The desktop is currently running vanilla Arch, to see how that is nowadays.

I don't like Ubuntu and Fedore because they try to do too much stuff automatically, and when (not if) that fails and something breaks, it's hell fixing it. They're also very slow in booting and have all this slow and pointless desktop stuff going on (though computers got a bit faster in the meantime). What I didn't like about Debian was that it seemed to have its own way of configuring everything instead of using the software's own config system, and it also had a bit too many packages and dependencies, it always seemed to want to pull in the whole world if one bit got updated. Slackware is fine if you install everything. I didn't, and then I discovered I really like automatic dependency resolving package management.

I haven't run Windows for probably 10 years now, though I've used it now and then of course.

Offline

#4 2013-10-25 12:05 PM

RobSeace
Administrator
From: Boston, MA
Registered: 2002-06-12
Posts: 3,847
Website

Re: Linux

Offline

#5 2013-10-25 08:18 PM

RipRage
Member
From: England
Registered: 2010-01-06
Posts: 146

Re: Linux

*-network                   
description: Wireless interface     
product: Centrino Wireless-N 2230     
vendor: Intel Corporation     
physical id: 0     
bus info: [email protected]:01:00.0     
logical name: wlan0     
version: c4    
serial: 60:36:dd:53:3b:6c    
width: 64 bits      
clock: 33MHz       
capabilities: bus_master cap_list ethernet physical wireless      
configuration: broadcast=yes driver=iwlwifi 
driverversion=3.2.0-51-generic firmware=18.168.6.1 
ip=192.168.1.3 latency=0 multicast=yes wireless=IEEE 802.11bgn     
resources: irq:44 
memory:f1500000-f1501fff
Kernel

Offline

#6 2013-10-25 10:03 PM

i3839
Oddministrator
From: Amsterdam
Registered: 2003-06-07
Posts: 2,239

Re: Linux

Don't bother porting the driver, try upgrading your kernel, firmware and/or system first.
But if you can ping your modem you have an IP address. What's your `route -n` output
and /etc/resolv.conf content?

Rob: That's systemd in a nutshell: Maddening non-UNIX like changes all over the
place with zero upsides. And of course journald is part of systemd... Another gem:
I can't find my coredumps back because systemd hides them somewhere...

Offline

#7 2013-10-26 12:47 AM

RipRage
Member
From: England
Registered: 2010-01-06
Posts: 146

Re: Linux

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.1.1     0.0.0.0         UG    0      0        0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 wlan0
192.168.1.0     0.0.0.0         255.255.255.0   U     1      0        0 eth0
192.168.1.0     0.0.0.0         255.255.255.0   U     2      0        0 wlan0

/etc/resolv.conf
nameserver 127.0.0.1

lo        no wireless extensions.

wlan0     IEEE 802.11bgn  ESSID:"RipRage"  
          Mode:Managed  Frequency:2.412 GHz  Access Point: 80:B6:86:C3:69:60   
          Bit Rate=1 Mb/s   Tx-Power=16 dBm   
          Retry  long limit:7   RTS thr:off   Fragment thr:off
          Power Management:on
          Link Quality=70/70  Signal level=-38 dBm  
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:1  Invalid misc:57   Missed beacon:0


wlan0     Link encap:Ethernet  HWaddr 60:36:dd:53:3b:6c  
          inet addr:192.168.1.2  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::6236:ddff:fe53:3b6c/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:37 errors:0 dropped:0 overruns:0 frame:0
          TX packets:119 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:2192 (2.1 KB)  TX bytes:17531 (17.5 KB)

Kernel Interface table
Iface   MTU Met   RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-DRP TX-OVR Flg
eth0       1500 0      3846      0      0 0          2726      0      0      0 BMRU
lo        16436 0       680      0      0 0           680      0      0      0 LRU
wlan0      1500 0        37      0      0 0           119      0      0      0 BMRU

Last edited by RipRage (2013-10-26 12:50 AM)

Offline

#8 2013-10-26 08:34 AM

i3839
Oddministrator
From: Amsterdam
Registered: 2003-06-07
Posts: 2,239

Re: Linux

Two problems: You got both eth0 and wlan0 with the same IP address and routes,
and you only got a 1 Mb/s link rate for your wireless. To get it working you need
to end up with a default gateway (G flag) on wlan0, not eth0. So what I guess is
that you're using the same subnet for both LAN and WLAN on your modem, which
confuses your laptop if you connect both ethernet and try to get wifi working.

So you could first try bringing eth0 down before trying to connect the wifi and see
if that works.

If the 1 Mb/s stays like that then that's probably a driver/firmware issue, or your
reception is really really bad.

The 127.0.0.1 in resolv.conf probably means you're using something like dnsmasq,
or some other DNS cacher.

But I'm just guessing.

Offline

#9 2013-10-26 02:48 PM

RobSeace
Administrator
From: Boston, MA
Registered: 2002-06-12
Posts: 3,847
Website

Re: Linux

Offline

#10 2013-10-28 05:41 PM

RipRage
Member
From: England
Registered: 2010-01-06
Posts: 146

Re: Linux

Offline

#11 2013-10-28 08:24 PM

RobSeace
Administrator
From: Boston, MA
Registered: 2002-06-12
Posts: 3,847
Website

Re: Linux

Offline

#12 2013-10-29 10:12 AM

i3839
Oddministrator
From: Amsterdam
Registered: 2003-06-07
Posts: 2,239

Re: Linux

I use NEdit and Vim. I really like NEdit's behaviour. I can't stand fancy IDE's and crap either.

I've always been a PC gamer, but I stopped playing games when I fully switched to Linux. They take too much time anyway. Since then I've only played the games a friend told me to try out. I'm glad he did, otherwise I wouldn't have played Portal.

Offline

#13 2013-10-29 12:23 PM

RobSeace
Administrator
From: Boston, MA
Registered: 2002-06-12
Posts: 3,847
Website

Re: Linux

Offline

#14 2013-10-31 08:36 AM

i3839
Oddministrator
From: Amsterdam
Registered: 2003-06-07
Posts: 2,239

Re: Linux

Valve should have started with Linux support ten years ago. Still great that they finally do start supporting Linux though. Pity about the abysmal driver support and that OpenGL didn't get its act together. Oh well.

Offline

#15 2013-10-31 12:23 PM

RobSeace
Administrator
From: Boston, MA
Registered: 2002-06-12
Posts: 3,847
Website

Re: Linux

Offline

#16 2013-11-05 01:05 PM

RipRage
Member
From: England
Registered: 2010-01-06
Posts: 146

Re: Linux

Portal, now that is one hell of a game, I also loved half life 2! Rob, have you played Sleeping Dogs? It's kinda of like GTA with Bruce Lee ;-)

Guys what do you think of a network diagnosis / autofix tool for linux? After solving my wireless issue It's kind of inspired me to write something cool and sophisticated to auto diagnose and fix network issues... But with linux being rarther robust compared so windows, I'm not sure if it will be needed or would require any use...

I have also been reading advance programming in the unix environment by Stevens :), I didn't realise that errno does not get reset between failed and succeeded system calls! That is strangely useful, on windows for example, socket() could fail setting GetLastError() then closessocket() would reset it back to 0! Meaning you would have to save and reset the error value when cleaning up and returning in a cover function

Last edited by RipRage (2013-11-05 01:10 PM)

Offline

#17 2013-11-05 02:09 PM

RobSeace
Administrator
From: Boston, MA
Registered: 2002-06-12
Posts: 3,847
Website

Re: Linux

Offline

#18 2013-11-11 01:04 PM

RipRage
Member
From: England
Registered: 2010-01-06
Posts: 146

Re: Linux

sizeof(struct arp) = 28 bytes

Last edited by RipRage (2013-11-11 02:48 PM)

Offline

#19 2013-11-11 04:52 PM

RobSeace
Administrator
From: Boston, MA
Registered: 2002-06-12
Posts: 3,847
Website

Re: Linux

Offline

#20 2013-11-14 12:33 PM

RipRage
Member
From: England
Registered: 2010-01-06
Posts: 146

Re: Linux

Offline

#21 2013-11-14 01:24 PM

RobSeace
Administrator
From: Boston, MA
Registered: 2002-06-12
Posts: 3,847
Website

Re: Linux

Offline

#22 2013-11-23 01:42 AM

RipRage
Member
From: England
Registered: 2010-01-06
Posts: 146

Re: Linux

Rob, I bought sleeping dogs last week and I haven't been able to put it down since!!! (I only played the demo beforehand) and man this game is intense, there's a few issues with the vehicles and bits and pieces here and there, not as 'fluid' as GTA but the combat system sure makes up for it, is freaking awesome! (fairly similar to AC if I remember rightly) I just love how the counter attacks work,  and how you interactive with the surroundings (I threw this one guy into a giant fish tank! ;-) )

Also been looking into the new consoles, have you heard of a game called "Destiny"? it may just be your thing, sci-fi FPS, but it seems to have some RPG aspects to it, the graphics look insane... on that note, are you much of a mass effect fan? I only played the first and was not overly keen, but I hear good things about 2 and 3,

While I'm here guys, can I just ask what's an appropriate way of programmatically executing another program? On windows I believe this is called hooking?

Also guys, I can honestly say, that I haven't booted into windows since I started this thread, I really do wish I felt comfortable with Linux sooner, I have always been interested, but have always gone back to windows for some reason or another, but I have to admit, I really love it, its just so quick and responsive, (in general, and of course the network side of things) I also found "codelite" this lovely lightweight IDE (i know you guys don't think much of IDE's but once you have used M$ vc++ for a while you kind of get used to it and anything else feels foreign) but this fantastic! and its so enjoyable writing in C on linux (its native language) none of this CamelCase and functions with a billion arguments (just my opinion, I don't want to offend anyone) I really hope to progress well under Linux, I have download various open source code and have been studying them slowly, the kernel (although one tough mother to understand) ifconfig/iwconfig, ISC's dhclient and loads of other bits of pieces...

Last edited by RipRage (2013-11-23 01:45 AM)

Offline

#23 2013-11-23 04:52 PM

RobSeace
Administrator
From: Boston, MA
Registered: 2002-06-12
Posts: 3,847
Website

Re: Linux

Offline

#24 2013-11-24 05:11 PM

RipRage
Member
From: England
Registered: 2010-01-06
Posts: 146

Re: Linux

I suppose system() will do, what I want to achieve is execute the dhclient, I.e "sudo dhclient -4 wlan0" in an event  where an interface for whatever reason is connect to a gateway / AP but hasn't been assigned an IP address, I suppose then I could call getifaddrs() again to check for an IP.  I would have a go at implementing a lightweight version of DHCP myself but I've read mixed bits and pieces saying that you cannot bind to an interface without an IP so some raw socket trickery is used ? Although saying that, I had no trouble releasing the IP set to on my wlan0 interface and passing 255.255.255.255 to getaddrinfo(), and binding with setsockopt(SO_BROADCAST)...

Offline

#25 2013-11-25 01:07 PM

RobSeace
Administrator
From: Boston, MA
Registered: 2002-06-12
Posts: 3,847
Website

Re: Linux

Offline

Board footer

Powered by FluxBB