Tag: networking

Entries for tag "networking", ordered from most recent. Entry count: 8.

Uwaga! Informacje na tej stronie mają ponad 6 lat. Nadal je udostępniam, ale prawdopodobnie nie odzwierciedlają one mojej aktualnej wiedzy ani przekonań.

Pages: 1

# How to Restrict Access to Apache Server to Local Machine?

Tue
22
Aug 2017

I wanted to do some web development locally, so I installed Apache 2.2, PHP, and MySQL on my Windows 10 machine. When configuring it, I wanted to restrict access to the Apache server to two machines only - local one and another one in my local network.

The way to do it is to enable and use mod_authz_host module. In file C:\Apache2\conf\httpd.conf I needed to make sure that following line is not commented:

LoadModule authz_host_module modules/mod_authz_host.so

Then I could add appropriate directives to <Directory ...> section of this file, or alternatively use them in .htaccess file located next to files of my website.

To deny access from all addresses except my two computers, I started from this:

Order deny,allow
Deny from all
Allow from 192.168.0.21
Allow from 192.168.0.23

After restarting Apache (needed to apply any changes in configuration), I found out that I could access my website from the other computer, but not from the local one. I quickly recalled that connections to the same machine go through special loopback interface and use special address: localhost, which has IP 127.0.0.1. So I changed my configuration to this:

Order deny,allow
Deny from all
Allow from 192.168.0.21
Allow from 192.168.0.23
Allow from 127.0.0.1

It didn't work either. That's when I started to search for address where the local connection comes from, using Process Hacker - Network tab, as well as Apache log in file C:\Apache2\logs\access.log. What I found out is that the loopback connection uses IPv6, where address of localhost is: "::1" - however strange it may seem. Explanation of this format can be found here: IPv6 at Wikipedia.

Apache accepts this form of address, so following configuration finally allowed me to connect from my local computer, as well as the other computer from my network:

Order deny,allow
Deny from all
Allow from 192.168.0.21
Allow from 192.168.0.23
Allow from 127.0.0.1
Allow from ::1

Comments | #webdev #networking Share

# UDP Sockets: send Function Blocks

Wed
20
Jul 2011

Today I've met an interesting problem with programming UDP sockets in C++. Generally UDP protocol just sends packets (datagrams) and doesn't care whether they are successfully delivered or not. They may be dropped or arrive out of order. Destination machine can even not read them or not exist at all! So I was sure that when I have a socket created with socket(), socktype=SOCK_DGRAM and connect(), I can then send packets using send() and expect this call will always be fast.

I was sure about that until today, when I met a case where a call to send() blocked for above 3 seconds! Then I've made some experiments. It looks like sending UDP packets from my Windows XP behaves like this:

I've found a question about this problem: "when does a udp sendto() blocks ?" at StackOverflow. It looks like this behavior is caused by the system unsuccessfully trying to resolve IP address to physical MAC address with every send. But it's highly operating system dependent so we can't do much about it. We just have to keep in mind that using blocking sockets for sending UDP packets can freeze our application or thread for even several seconds with each packet sent.

13 Sep 2011 Update: I researched this issue further and it looks like it's even more specific. If the target machine was online and contacted before, but now it's offline, send() is very quick. Only if the ARP forgets the IP-MAC pair for that machine, send() blocks for such a long time with every call. It probably happens after several hours. You can also force ARP to clear the cache by issuing following console command in Windows, as Administrator: arp -d *.

Comments | #networking Share

# JustSendIt Prototype

Thu
07
Oct 2010

It's not a new idea for me, but last weekend it made me angry again that I couldn't send a file from my laptop to my desktop PC over my home local network. It may seem strange and it's really shocking to me because transferring data is the most fundamental thing we do when using any kind of network. But at the same time I don't know about any program that would simply allow me to send a file to a destination machine without being overly sophisticated or causing some strange technical problems. Here are solutions I've considered:

Network Neighbourhood - most natural way of passing files between Windows computers. I tried to share some folder on my laptop to access it from my PC and it didn't work, despite machines could contact each other via hostname or IP. Same happened when I shared a folder on my desktop and tried to enter it from my laptop. Well, we all know that this service often stop working randomly... Disabling Windows Firewall on both machines didn't help either.

FTP - I have FileZilla FTP server installed on both machines and I know it's quite good software, but that day I couldn't make it work. I could logon to the server from remote machine, but not to transfer any file. I tried different settings on client side like Passive Mode etc., but it changed nothing. I don't like the idea of using FTP to transfer files anyway, because why do I have to install the server, setup user accounts etc. when I just want to transfer a file? Besides, FTP protocol is known for causing technical problems because it opens separate connections on different ports to transfer data.

Other possibilities to send a file over a network are:

So finally I've used an USB flash memory stick to copy this file :P But after this, I've recalled my old idea about a simple program to transfer files over a network called JustSendIt [PL]. Then I decided to code a quick prototype of such program in C# and here it is: JustSendIt Prototype. It requires .NET Framework 4.0 to work.


If you have some computers at home or at work that you transfer files between or if you want to a file to your friend over the Internet, you are sure one of the computers have public IP or is set as DMZ so the other can connect to it, the way to send a file is:

  1. Run JustSendIt Prototype on both machines.
  2. On the receiving machine, go to Receive tab and press Load button to see your computer name and IP address..
  3. On the sending machine, go to Send tab, click Browse button to select a file to be sent, as well as enter the name or IP of the destination computer.
  4. On receiving machine, press the big Receive! buton to start waiting for incoming connections.
  5. On sending machine, press the big Send! button to connect to the second machine.
  6. On the receiving machine, a dialog pops-up to as user about the directory where to save the incoming file.
  7. After confirming this dialog, the file is transferred until finished.

I hope some day I'll find enough motivation to polish and finish this program :)

Comments | #networking #tools #windows Share

# Unusual Devices at Work

Sat
17
Oct 2009

One of the best things in having a real job as a programmer is working with unusual devices that cannot be seen in an average house. For example when I worked at Microsoft I've been using a KVM - a device that allows a user to control multiple computers from a single keyboard, video monitor and mouse. At Metropolis Software we had Xbox 360 Devkits - gray boxes a bit taller than normal Xbox 360, which could execute and debug game code developed on the PC. And now in Cyfrowy Polsat we have numerous strange boxes doing different things, like RedRat, which simulates IR remote control.

I'm also dealing with a PDU (Power Distribution Unit). It can supply many devices and outlets can be turned on/off programatically via SNMP protocol. By the way, SNMP (Simple Network Management Protocol) is a UDP-based protocol for monitoring and controlling devices connected to a network, such as routers, advanced switches, printers etc. It looks like a hierarchical "property grid" with variables of different types (like string or number), which can be queried and set. There are many client applications, both free and commercial - just look at the list at SNMPLink.org portal. When it comes to libraries for programmers, I've found free Net-SNMP for C and SNMP++ for C++.

Comments | #hardware #networking Share

# Sockets and How to Learn Them

Wed
14
Oct 2009

Everyone who wants to code transferring data across a network has to learn the concept and API of sockets, no matter if he works in Windows or Linux. I currently work with them again. The most popular tutorial to start with sockets is AFAIK Beej's Guide to Network Programming (and here is my mirror of the Polish translation: [html], [pdf]). I've recently came across another great document: Winsock Programmer's FAQ. I generally like FAQ-s as a good way to start learning about new topic and this one contains many valuable advices. I especially like the article Which I/O Strategy Should I Use? beacuse it explains what ways are available to do asynchronous I/O with sockets under Windows.

Each time I use sockets, I ask myself whether it has to be so much complicated, with all these states, errors, structures, flags etc. I'm afraid it always has to be this way as I've seen many implementations of wrappers and all looked very similar or almost the same as the original. The only way to simplify this API is to limit its functionality or to take it to the higher level of abstraction, like RPC. I believe writing network code is so hard because:

Comments | #networking Share

# About the Guy Who Made Love

Sat
22
Aug 2009

Today I want to talk a bit about what's the dream of almost every passionate game developer. It seems very hard or almost impossible to achieve, but younger amateurs still hope that they will manage to do it someday. Of course I'm talking about making a 3D MMO game.

As it turned out for me today (thanks for the link KriS!), it actually IS possible. I'm talking about the game called Love written entirely by one person - Eskil Steenberg. He have coded all the software from modeling tools through network protocol and renderer until game mechanics. To see it working I recommend watching these videos. The game is powered by his engine called Quel Solaar, which is actually available for download.

I must admit I haven't been impressed so much for a long time. I suppose the amount of time and passion that had to be put into this code is enormous. Graphical style and gameplay, as well as the user interface of his tools are very unusual and surprising. And all of this is made by one guy...

I recommend watching his lecture from this year's Assembly party titled Developing the technology behind "Love". You can see many technical details and if you don't want to watch the entire one hour video, at least watch the beginning (where he talks about his "smarter way of doing things") and the ending (where he expresses his thoughts about the value of good tools).

BTW it's also nice to watch new videos from GC 2009 of the CryEngine 3. "What you see is what you play" and instant asset update (including textures) - that's how good game editor should look like :)

Comments | #software engineering #networking #web #rendering #games #events #engine #demoscene #philosophy #tools Share

# Architektura serwera MMO

Fri
30
Mar 2007

Czytając sobie różne materiały dochodzę do wniosku, że architekturę rozproszonego serwera gry MMO można podzielić na dwa rodzaje:

  1. Podział na węzły ze względu na pełnioną funkcję - na przykład osobny serwer nazw, osobny AI, osobny walki, osobny przedmiotów itd.
  2. Podział na węzły ze względu na symulowany obszar świata gry

W swoich na razie tylko teoretycznych rozważaniach skłaniałbym się obecnie ku opcji drugiej, bo wydaje mi się znacznie prostsza w implementacji i bardziej skalowalna.

Comments | #software engineering #networking Share

# cgd213.neoplus.adsl.tpnet.pl

Wed
10
Jan 2007

Jak wykazał prowadzony przeze mnie od kilku dni całodobowy monitoring łącza, Neostrada dokładnie co 24 godziny rozłącza celem zmiany IP przydzielając za każdym razem adres IP wyglądający jak 83.30.*.* oraz nazwę hosta *.neoplus.adsl.tpnet.pl.

Wartość merytoryczna takich badań jest wątpliwa, ale jako osobę nie znającą się zbytnio na sieciach intryguje mnie, po co zadawać sobie trud regularnego zmieniania tego adresu? Jedyną chyba jego zaletą jest lepsza anonimowość dla wszelkiego rodzaju internetowych przestępców :P

Comments | #web #networking Share

Pages: 1

[Download] [Dropbox] [pub] [Mirror] [Privacy policy]
Copyright © 2004-2024