Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / desktop / MFC

RaspberryPi2 Server-ASUSlaptop Client, Blocking Socket, 2 Fonts

5.00/5 (2 votes)
11 Oct 2015CPOL1 min read 9.5K  
Wifi communication between RaspberryPi2 and Laptop ASUS: fonts English, Russian.

Introduction

I use VisualGDB to program Raspberry from laptop.

I almost copied the 2 applications listed below and they worked well.

  1. http://codebase.eu/tutorial/linux-socket-programming-c/index.php#comments
  2. https://msdn.microsoft.com/en-us/library/windows/desktop/ms737591(v=vs.85).aspx

Then, I wanted to add some internationalization and here began the new part.

  1. http://stackoverflow.com/questions/215963/how-do-you-properly-use-widechartomultibyte/3999597#3999597
  2. http://man7.org/linux/man-pages/

You must prepare Raspberry with this: http://www.jaredwolff.com/blog/raspberry-pi-setting-your-locale/ where you need Russian and Italian.

  1. Download TcpIpServer4.rar
  2. Download TcpIpClient5.rar
  3. Download SomeRussian.rar
  4. Download SomeItalian.rar

Background

Setting up Raspberry.

Using the Code

As this is a tip, I don't show code here, but it is inside the folders I've uploaded. Put TcpIpServer in one directory of Raspberry. Create from Raspberry root dir /MyDirect and put SomeRussian and SomeItalian inside.

Start server. Start client: in Tx write the server's ip, push Communicate. Then in Tx write some text, push Communicate. To end a correct communication, push OK. To quit at any moment, push x sys command.

To avoid program's block, OK and x sys command are sometimes disabled. In particular, I disable x sys command during connection. For a wrong ip format answer is immediate. For a wrong ip or for server not present, the waiting time is some tens of seconds: blocking socket mode.

For the intermediate messages, you can write in Italian or English or in Russian and the server will display correctly in PuTTY console.

My server and laptop communicate via wifi.

To create SomeRussian open in Windows text editor a new file, write in Russian with an adequate keyboard and save the file with UTF-8 encoding. For SomeItalian, it's the same (Italian keyboard). Copy these 2 files (without extension) in the dir chosen.

Image 1

History

  • 11th October, 2015: Initial version

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)