Tag: networking

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

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

Pages: 1

14:48
Wed
20
Jul 2011

UDP Sockets: send Function Blocks

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 (1) | Tags: networking | Author: Adam Sawicki | Share

20:00
Thu
07
Oct 2010

JustSendIt Prototype

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 (1) | Tags: networking tools windows | Author: Adam Sawicki | Share

00:19
Sat
17
Oct 2009

Unusual Devices at Work

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 (0) | Tags: hardware networking | Author: Adam Sawicki | Share

19:19
Wed
14
Oct 2009

Sockets and How to Learn Them

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 (0) | Tags: networking | Author: Adam Sawicki | Share

16:08
Sat
22
Aug 2009

About the Guy Who Made Love

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 (2) | Tags: software engineering networking web rendering games events engine demoscene philosophy tools | Author: Adam Sawicki | Share

09:54
Fri
30
Mar 2007

Architektura serwera MMO

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 (0) | Tags: software engineering networking | Author: Adam Sawicki | Share

18:43
Wed
10
Jan 2007

cgd213.neoplus.adsl.tpnet.pl

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 (9) | Tags: web networking | Author: Adam Sawicki | Share

Pages: 1

STAT NO AD [Stat] [Admin] [STAT NO AD] [pub] [Mirror] Copyright © 2004-2017 Adam Sawicki
Copyright © 2004-2017 Adam Sawicki