• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 14:33
CEST 20:33
KST 03:33
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
[ASL21] Ro8 Preview Pt1: Inheritors14[ASL21] Ro16 Preview Pt2: All Star10Team Liquid Map Contest #22 - The Finalists19[ASL21] Ro16 Preview Pt1: Fresh Flow9[ASL21] Ro24 Preview Pt2: News Flash10
Community News
2026 GSL Season 1 Qualifiers22Maestros of the Game 2 announced92026 GSL Tour plans announced15Weekly Cups (April 6-12): herO doubles, "Villains" prevail1MaNa leaves Team Liquid25
StarCraft 2
General
Team Liquid Map Contest #22 - The Finalists MaNa leaves Team Liquid Maestros of the Game 2 announced 2026 GSL Tour plans announced Blizzard Classic Cup @ BlizzCon 2026 - $100k prize pool
Tourneys
2026 GSL Season 1 Qualifiers Sparkling Tuna Cup - Weekly Open Tournament INu's Battles#14 <BO.9 2Matches> GSL CK: More events planned pending crowdfunding RSL Revival: Season 5 - Qualifiers and Main Event
Strategy
Custom Maps
[D]RTS in all its shapes and glory <3 [A] Nemrods 1/4 players [M] (2) Frigid Storage
External Content
The PondCast: SC2 News & Results Mutation # 523 Firewall Mutation # 522 Flip My Base Mutation # 521 Memorable Boss
Brood War
General
[ASL21] Ro8 Preview Pt1: Inheritors BGH Auto Balance -> http://bghmmr.eu/ FlaSh: This Will Be My Final ASL【ASL S21 Ro.16】 Leta's ASL S21 Ro.16 review ASL21 General Discussion
Tourneys
[Megathread] Daily Proleagues [ASL21] Ro8 Day 1 [ASL21] Ro16 Group D Escore Tournament StarCraft Season 2
Strategy
Fighting Spirit mining rates Simple Questions, Simple Answers What's the deal with APM & what's its true value Any training maps people recommend?
Other Games
General Games
Dawn of War IV Stormgate/Frost Giant Megathread Diablo IV Nintendo Switch Thread Total Annihilation Server - TAForever
Dota 2
The Story of Wings Gaming
League of Legends
G2 just beat GenG in First stand
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Deck construction bug Heroes of StarCraft mini-set
TL Mafia
Vanilla Mini Mafia Mafia Game Mode Feedback/Ideas TL Mafia Community Thread Five o'clock TL Mafia
Community
General
US Politics Mega-thread 3D technology/software discussion European Politico-economics QA Mega-thread Canadian Politics Mega-thread Things Aren’t Peaceful in Palestine
Fan Clubs
The IdrA Fan Club
Media & Entertainment
Anime Discussion Thread [Manga] One Piece [Req][Books] Good Fantasy/SciFi books Movie Discussion!
Sports
2024 - 2026 Football Thread Formula 1 Discussion McBoner: A hockey love story
World Cup 2022
Tech Support
streaming software Strange computer issues (software) [G] How to Block Livestream Ads
TL Community
The Automated Ban List
Blogs
Sexual Health Of Gamers
TrAiDoS
lurker extra damage testi…
StaticNine
Broowar part 2
qwaykee
Funny Nicknames
LUCKY_NOOB
Iranian anarchists: organize…
XenOsky
Customize Sidebar...

Website Feedback

Closed Threads



Active: 2653 users

[H] Named Pipes part 2

Blogs > Phyre
Post a Reply
Phyre
Profile Blog Joined December 2006
United States1288 Posts
November 15 2009 15:47 GMT
#1
Hi guys, thanks for the advice. Sorry it took so long to respond, I don't have much time to work on this during the week. Continuing from my last blog post, I think I've made a little headway.

I've been trying to get a C++ client to send a message to a C# server and I'm having difficulty on the C++ client side. I'm using the sample C++ client shown here with no changes at all, 100% copy/pasted right now. The problem seems to be in the line where I'm trying to set the Read Mode with SetNamedPipeHandleState() to PIPE_READMODE_MESSAGE. When I have the client try to connect to the server it stops and prints "SetNamedPipeHandleState failed. GLE=87".

I heard that setting the read mode to Message can fail if the pipe is set to Byte mode on the server end but pipes are set to Message mode by default in C# anyway. I manually set the read mode of the C# server anyway with "pipeServer.ReadMode = PipeTransmissionMode.Message;" just incase and that caused the server to crash when the client attempted to connect.

The closest I've gotten to making this work is setting the Readmode on the C++ client end to Byte with "dwMode = PIPE_READMODE_BYTE;" which allows the client to successfully send a message to the server, albeit a bit messed up. The text I send in Byte mode has spaces between every letter which is obviously not what I want.

The server code I'm using is this:

using System;
using System.IO;
using System.IO.Pipes;

class PipeServer
{
static void Main()
{
ListenServer();
}

static void ListenServer()
{
bool keepRunning = true;

while (keepRunning)
{
using (NamedPipeServerStream pipeServer =
new NamedPipeServerStream("testpipe", PipeDirection.InOut))
{
//Console.WriteLine("NamedPipeServerStream object created.");

// Wait for a client to connect
Console.WriteLine("Pipe Server");
Console.WriteLine("Waiting for client connection...");
pipeServer.WaitForConnection();
//pipeServer.ReadMode = PipeTransmissionMode.Message;

Console.WriteLine("Client connected.");
try
{
using (StreamReader sr = new StreamReader(pipeServer))
{
// Display the read text to the console
string temp;
while ((temp = sr.ReadLine()) != null)
{
Console.WriteLine("Received from client: {0}", temp);
}
}
}
// Catch the IOException that is raised if the pipe is
// broken or disconnected.
catch (IOException e)
{
Console.WriteLine("ERROR: {0}", e.Message);
}
}
}
}
}


Thanks for reading if you've made it this far, the help is very much appreciated!

"Oh no, I got you with your pants... on your face... That's not how you wear pants." - Nintu, catching 1 hatch lurks.
Phyre
Profile Blog Joined December 2006
United States1288 Posts
November 15 2009 19:11 GMT
#2
Turns out I was setting the Readmode on the C# server end of things at the wrong time. I moved it to be before the WaitForConnection call and it works now. Says everywhere I've read that C# pipes are supposed to default to Message mode to begin with but they apparently don't. So, that's fixed but the text is still being sent to the server with a blank space between every character which is confusing me. I'll keep looking.
"Oh no, I got you with your pants... on your face... That's not how you wear pants." - Nintu, catching 1 hatch lurks.
Phyre
Profile Blog Joined December 2006
United States1288 Posts
November 15 2009 20:47 GMT
#3
And finally, a friend of mine helped solved the last piece of this puzzle. Just had to change the output of the C++ client to "Not Set" aka ASCII in the project properties instead of Unicode.

Now to make the C++ client a service and the C# server a GUI app. Can't be that bad...
"Oh no, I got you with your pants... on your face... That's not how you wear pants." - Nintu, catching 1 hatch lurks.
Please log in or register to reply.
Live Events Refresh
Monday Night Weeklies
16:00
#49
RotterdaM1008
TKL 378
IndyStarCraft 236
SteadfastSC221
BRAT_OK 165
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
RotterdaM 1008
TKL 378
IndyStarCraft 236
SteadfastSC 221
BRAT_OK 165
UpATreeSC 94
JuggernautJason5
StarCraft: Brood War
Calm 4373
ggaemo 359
Hyun 68
Free 64
Shinee 62
PianO 58
Sexy 33
910 21
HiyA 16
NaDa 6
Dota 2
qojqva4500
capcasts59
Counter-Strike
fl0m2110
pashabiceps1792
byalli1680
Super Smash Bros
Mew2King56
Heroes of the Storm
Khaldor255
Other Games
Grubby4660
B2W.Neo1185
Beastyqt777
ceh9629
Sick234
KnowMe226
C9.Mang0215
mouzStarbuck205
Hui .136
Trikslyr43
MindelVK12
Organizations
Other Games
BasetradeTV379
Dota 2
PGL Dota 2 - Main Stream294
StarCraft: Brood War
Kim Chul Min (afreeca) 7
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
[ Show 19 non-featured ]
StarCraft 2
• kabyraGe 111
• StrangeGG 79
• Kozan
• LaughNgamezSOOP
• AfreecaTV YouTube
• sooper7s
• intothetv
• Migwel
• IndyKCrew
StarCraft: Brood War
• FirePhoenix25
• 80smullet 12
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
Dota 2
• WagamamaTV639
League of Legends
• Nemesis3610
Other Games
• imaqtpie1218
• Shiphtur229
• tFFMrPink 9
Upcoming Events
Replay Cast
5h 27m
Replay Cast
14h 27m
Afreeca Starleague
15h 27m
Leta vs YSC
GSL
1d 14h
Rogue vs Percival
Zoun vs Solar
Replay Cast
2 days
GSL
2 days
Cure vs TriGGeR
ByuN vs Bunny
The PondCast
2 days
KCM Race Survival
2 days
Replay Cast
3 days
Replay Cast
3 days
[ Show More ]
Escore
3 days
Replay Cast
4 days
Replay Cast
4 days
IPSL
4 days
Ret vs Art_Of_Turtle
Radley vs TBD
BSL
5 days
Replay Cast
5 days
uThermal 2v2 Circuit
5 days
BSL
6 days
IPSL
6 days
eOnzErG vs TBD
G5 vs Nesh
Replay Cast
6 days
Wardi Open
6 days
Afreeca Starleague
6 days
Jaedong vs Light
Monday Night Weeklies
6 days
Liquipedia Results

Completed

Escore Tournament S2: W4
WardiTV TLMC #16
Nations Cup 2026

Ongoing

BSL Season 22
ASL Season 21
CSL 2026 SPRING (S20)
IPSL Spring 2026
KCM Race Survival 2026 Season 2
StarCraft2 Community Team League 2026 Spring
IEM Rio 2026
PGL Bucharest 2026
Stake Ranked Episode 1
BLAST Open Spring 2026
ESL Pro League S23 Finals
ESL Pro League S23 Stage 1&2
PGL Cluj-Napoca 2026

Upcoming

Escore Tournament S2: W5
KK 2v2 League Season 1
Acropolis #4
BSL 22 Non-Korean Championship
CSLAN 4
Kung Fu Cup 2026 Grand Finals
HSC XXIX
uThermal 2v2 2026 Main Event
Maestros of the Game 2
2026 GSL S2
RSL Revival: Season 5
2026 GSL S1
XSE Pro League 2026
IEM Cologne Major 2026
Stake Ranked Episode 2
CS Asia Championships 2026
IEM Atlanta 2026
Asian Champions League 2026
PGL Astana 2026
BLAST Rivals Spring 2026
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2026 TLnet. All Rights Reserved.