2

I want to be able to run a server (created with python sockets) on a raspberry pi 2 and connect to a client running on pc via wifi without having a connection to a router or to the internet.

I've done a lot of research and followed numerous tutorials but I still haven't been able to so much as ping the pi from my pc. Should I be focusing on creating an ad-hoc network between the pc and the pi, or should I be trying to configure the pi as an access point of some kind? All I need to do is to be able to send the pi simple textual/numerical messages from client which will run on my pc.

If anyone could point me in the right direction I would be grateful!

The Pi has the latest version of raspbian and I'd like to run the client from my pc using either linux or windows 10, either way doesn't really matter to me.

  • As it stands this question is too vague. There are very many ways of connecting without a "network". Without internet access the Pi will not have time (unless you use alternate means or a NTP server). – Milliways Jan 12 '16 at 7:24
  • With the ease with which one can get a GPS module for the RPi one of those can be a really accurate way to get the time - especially in out-door, back of beyond, WiFi free situation. An RTC module is even cheaper - and will only need setting one per lithium cell change... – SlySven Jan 13 '16 at 0:11
2

I got a wifi adapter for my pi when I got it. Recently I went through the steps to turn it into a wireless access port (there are a few guides on this).

Now I use it all the time without internet--I switch my PC over to my PiWiFi access point and ssh to 192.168.42.1 and I'm good to go.

Additionally:

  • Music/file server when I'm in my car with the addition of a USB stick
  • You can run offline web, game and other servers.
  • If I have the right wire network handy I'll plug an ethernet into the PI and suddenly I'm hooked up to the PI AND I have internet access through it--portable wifi hotspot.
  • I can add LEDs to display network load, game server state, etc.
  • All the girls find it really sexy

I may have gotten carried away a little but you get the idea.

  • The last couple of points do seem useful. 192.168.42.x network because 42 IS the answer I take it? 8-) – SlySven Jan 13 '16 at 0:03
  • @SlySven Honestly I had exactly the same thought when I saw .42. in one of the guides and said "Yep, that's the answer" and used that guide. – Bill K Feb 1 '16 at 17:09
1

Did you tried to use: netsh wlan set hostednetwork on Windows? Link It is very simple way to have access point without any software. First you issue the command netsh wlan set hostednetwork ssid=your_ssid key=your_passphrase mode=allow Then you need to share your internet connection via control panel (if you want it someday, if not then on to the next step) and finally start hostednetwork. Remember that this will last till the next restart so better add the start hostednetwork as startup script or execute it again from cmd. Edit: if you want to set it on RPi (like it should be) then I can point you to edit /etc/network/interfaces file (easy and not safe) or do it with wpa_supplicant harder but with wpa2 key. Now you can get some dhcp server if you want or remain static. Now it can be necessary to turn off the built in network manager to get this work. Have fun.

  • The OP doesn't say that they actually have an Internet Connection to Share! – SlySven Jan 12 '16 at 2:10
  • ICS is an optional step. – NightKn8 Jan 12 '16 at 6:33
0

Technically a cross-over Cat-5 (or better) lead between the two ought to work but it may be a bit confusing for both you and some software if packets pass between the two and packet addresses are ignored but still get through. You may find the Windows PC, in the absence of a DHCP server, adopting an automatic IPv4 address from the link-local 169.254.x.x range (they call it Automatic Private IP Addressing a.k.a. APIPA). This takes extra time compared to using DHCP as it has to check quite hard that an address is free to use.

Given that you plan to use the RPi as one sort of server already the easiest solution (if you are NOT using a wireless router, which can do this in a few browser clicks once you use a wired connection to it and can find it's IP-address in the first place), you could configure it to be a DHCP server as well - you will likely want to install the isc-dhcp-server package and dependencies on the RPi.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.