Update MQL4 600 & Named Pipes - page 3

 

Ok, if my problem when I change to mode W unicode is to connect the pipe in side MT4, so I thing that the string \\\\.\\pipe\\mypipe no more a simple string but contain the null values like de FMIC said. So is why I cant connect in my vb.net side because when I use the same string \\\\.\\pipe\\mypipe is not found and I receive the error 2.

I try to connect convert the string with the StringToCharArray but the pipe connect got error.

Make sense? Thanks

 
hmm, I am wrong, off course...else if when I use in mt4 side with A ansi mode my vb.net side also will not connect but it do...
 

I use this line code to show me all the pipes opened.

Dim listOfPipes As [String]() = System.IO.Directory.GetFiles("\\.\pipe\")

and my pipe is there. So mt4 with unicode mode "W" are creating the pipe and waiting for connections. If I can create in the same mt4 side a pipe client I can test...

 
I dont know what to do...
 
bisewski:
I dont know what to do...
Can you post a summary of your situation, as it's not very clear I think.
 

I open a post in msdn forum because I thing that the problem is in my vb.net side.

http://social.msdn.microsoft.com/Forums/en-US/409d4a2d-0a88-4094-9f0c-403798a2ce3d/pipe-unicode-mode-not-connecting-like-ansi-mode?forum=vbgeneral

I can create the pipe with my mt4 code but I can connect or call for them.

When I use ansi mode in my vb.net program, I can to connect the pipe but I receive only the first letter. So I change to unicode mode and know I cant connect...I receive the error 2.

So I thing that my ptoblem is now with my vb.net code and not mode my mql4.

Thanks for all helpers...

 

If someone still has problems managing named pipes in MT4 v600, this is the way I solved it:

  • Changing CreateNamedPipeA and CreateFileA, with CreateNamedPipeW and CreateFileW
  • Changing the declarations in ReadFile and WriteFile (Buffer), so, I can work with CharArrays (1 byte per character):
int WriteFile(int FileHandle, uchar & Buffer[], int BufferLength, int & BytesWritten[], int PassAsZero);

int ReadFile(int FileHandle, uchar & BufferPtr[], int BufferLength, int & BytesRead[], int PassAsZero);

  • Using Char arrays to comunicate between the server and client:

Server:

string ReadBuffer = "";
uchar Buff_in[200];
int BytesRead[1] = {0};
ReadFile(glbPipe[PipeIndex], Buff_in, 200, BytesRead, 0);
ReadBuffer = CharArrayToString(Buff_in,0,BytesRead[0]);
if (BytesRead[0] > 0) {
   strReturnValue = StringConcatenate(strReturnValue, ReadBuffer);   
   TotalBytesRead += BytesRead[0];
} 

Client:

uchar Mess_char[];
StringToCharArray(Message, Mess_char,0);
WriteFile(PipeHandle, Mess_char, StringLen(Message), BytesWritten, 0);
 

Thank you Oscarin for your summary.

 
Thanks sr...
 
oscarin:

If someone still has problems managing named pipes in MT4 v600, this is the way I solved it:

  • Changing CreateNamedPipeA and CreateFileA, with CreateNamedPipeW and CreateFileW
  • Changing the declarations in ReadFile and WriteFile (Buffer), so, I can work with CharArrays (1 byte per character):

  • Using Char arrays to comunicate between the server and client:

Server:

Client:


In what code have you performed the indicated changes? 

 Does anybody know this?

 I'm eager to start working with named pips in MT4 600+ though I haven't been able to find a working solution yet. Any help much appreciated! 

Reason: