• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 13:58
CET 19:58
KST 03:58
  • 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
[ASL22] Finals Preview: Sweet Victory!12[ASL22] Ro4 Preview: Mirror Mirror6[ASL22] Ro8 Preview: Within Reach5[ASL22] Ro8 Preview: In A Tizzy11[ASL22] Ro16 Preview: Holy Diver5
Community News
[BSL23] RO16 Group Stage7Weekly Cups (Nov 2-8): herO back on top?1Weekly Cups (Oct 26 - Nov 1): MaxPax, herO, Solar win0Weekly Cups (October 19-25): Clem triples first in 5.0.175Evil Geniuses - shutting down23
StarCraft 2
General
Serral's getting trashed by New Catsle's Mind No more SC2 streamers on team liquid? Weekly Cups (Nov 2-8): herO back on top? StarCraft open world shooter announced at BlizzCon [D] Hacker peak in sc2 ?
Tourneys
RSL goes to London! 2026 Offline Finals Nov 21-22 Tasteless Time Warp: SC Evo Showmatch (May 25) Sparkling Tuna Cup - Weekly Open Tournament SC2 iNu's Battles #22 SC4ALL: II Venue Change Announcement!
Strategy
[H] ZvP Mid-Late Game: Stalkers Collossi HT
Custom Maps
Starcraft 2 Advance [G] How to playtest arcade maps [D] the control group Simple Questions/Answers
External Content
The PondCast: SC2 News & Results Mutation # 551 Robotic Revival Mutation # 550 Graveyard Shift Mutation # 549 Endless Sparkles
Brood War
General
[BSL23] RO16 Group Stage [Megathread] Daily Funny Videos List of top players active on ShieldBattery screpdb: new Starcraft reporting tool BW General Discussion
Tourneys
[$1250] International ShieldBattery League 2v2v2v2 Tournament Stage 1: Community Poll [Megathread] Daily Proleagues Small VOD Thread 2.0
Strategy
Nuke strategy worked in K-League 2026-11-09 50,000-Word Terran Builds Memo 2026-10-22 Cliff Jump Revisited (1 in a 1000 strategy)
Other Games
General Games
Nintendo Switch Thread General RTS Discussion Thread ZeroSpace Early Access is Now Live! Path of Exile Stormgate/Frost Giant Megathread
Dota 2
Dota 2 Champions League Season 3 Begins April 25!
League of Legends
[TL LoL EUW IHs] Teemo shall perish
Heroes of the Storm
Heroes of the Storm 2.0
Hearthstone
Deck construction bug
TL Mafia
TL Mafia Community Thread
Community
General
US Politics Mega-thread Trading/Investing Thread Russo-Ukrainian War Thread Dating: How's your luck? Things Aren’t Peaceful in Palestine
Fan Clubs
Fan Club Resource Thread Reynor Fan Club The Flash Fan Club
Media & Entertainment
Movie Discussion! Anime Discussion Thread [Manga] One Piece
Sports
Football (Soccer) Thread TeamLiquid Health and Fitness Initiative For 2023 MLB/Baseball 2023
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List Recent Gifted Posts
Blogs
The time I organised my…
AssyrianKing
Why I built Repalyzer (1.1.…
BlueStar
Innovate or Game Over?
TrAiDoS
ShieldBattery on Mac
Kraekkling
[ASL22] Ro4 Day1 Ticket Giv…
bITt.mAN
Can Bots Beat Pros?? Starcr…
namkraft
Customize Sidebar...

Website Feedback

Closed Threads



Active: 13324 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
Next event in 4h 3m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
mouzStarbuck 62
BRAT_OK 54
EmSc Tv 24
MindelVK 18
StarCraft: Brood War
Britney 10230
Rain 1478
Dewaltoss 136
ProTech102
Zeus 71
Aegong 22
Hm[arnc] 18
JYJ 14
Dota 2
qojqva2363
Dendi1204
420jenkins299
monkeys_forever204
Counter-Strike
ScreaM1494
zeus944
x6flipin425
jkaem219
gobbtv181
Heroes of the Storm
Liquid`Hasu324
Trikslyr75
Other Games
singsing1669
FrodaN1311
ceh9576
ToD187
ArmadaUGS143
QueenE108
Grubby74
UpATreeSC46
NeuroSwarm37
Railgan33
B2W.Neo0
Organizations
StarCraft 2
TaKeTV 323
EmSc Tv 24
EmSc2Tv 24
[ Show 18 non-featured ]
StarCraft 2
• StrangeGG 30
• Adnapsc2 24
• Reevou 8
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• Migwel
StarCraft: Brood War
• blackmanpl 23
• Michael_bg 6
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• C_a_k_e 2427
League of Legends
• Nemesis2867
• TFBlade678
Other Games
• imaqtpie802
• Shiphtur541
Upcoming Events
OSC
4h 3m
ByuN vs MaxPax
herO vs Krystianer
Percival vs Shameless
LetaleX vs YoungYakov
Nicoract vs Gerald
GgMaChine vs ArT
PiGosaur Cup
6h 3m
INu's Battles
17h 3m
ByuN vs Classic
3D!Clan Event
21h 33m
The PondCast
1d 15h
KCM Race Survival
1d 15h
WardiTV Invitational
1d 17h
OSC
2 days
Ultimate Battle
2 days
CranKy Ducklings
3 days
[ Show More ]
IPSL
3 days
TerrOr vs IJ_Terran
rasowy vs Hazorath
BSL
4 days
TerrOr vs OyAji
UltrA vs Gosudark
Sparkling Tuna Cup
4 days
IPSL
4 days
Art_Of_Turtle vs KameZerg
Radley vs George
BSL
5 days
Artosis vs Dewalt
Ret vs Tech
WardiTV Weekly
5 days
Liquipedia Results

Completed

Proleague 2026-11-09
Blizzard Classic Cup 2026
HCC Season 3

Ongoing

Acropolis #5
KCM Race Survival 2026 Season 4
International ShieldBattery League
Individual League
BSL Season 23
IPSL Winter 2026-27
Calamity Cup Div. A Season 8
IEM Beijing 2026
PGL Masters Bucharest 2026
Stake Ranked Episode 5
1win Private Club #2
Thunderpick World Champ. '26
ESL Pro League Season 24
Stake Ranked Episode 4
1win Private Club #1
Logitech G Play Connect 2026
SL StarSeries Fall 2026
FISSURE Playground #3
BLAST Open Fall 2026

Upcoming

YSL S4
Sector 951
SC4ALL II: Brood War
BSL 23: Non-Korean Championship
HSC XXX
Stellar Fest 2: Lunar Cup
StarCraft2 Weekly Open Tournament 2026 Grand Finals
SC4ALL II: StarCraft II
Kung Fu Cup 2026 Grand Finals
RSL Offline Finals
Underdog Cup 2026 Div 2-3
PGL Bucharest 2027
BLAST Bounty Winter 2027
eXTREMESLAND 2026
PGL Major Singapore 2026
Stake Ranked Episode 6
BLAST Rivals Fall 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.