Jump to content

[C] Server doesn't send a message on mailslot

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
3 replies to this topic

#1
Alhazred

Alhazred

    Learning Programmer

  • Members
  • PipPipPip
  • 99 posts
I'm writing a client-server software which should emulate an email service. I'm now at the beginning and I'm trying to let communicate the client and the server process. I have no problem writing a new email, I send it to the server and the server saves it. I have a problem when I have to read an email from the server.
The client sends the request, the server receives it and read the email, but it doesn't send the message to the client, I've seen the server doesn't write on the mailslot, the number of bytes written is always 0.

Can you see the problem?

sorry for my english... I'm italian :p

#2
Alhazred

Alhazred

    Learning Programmer

  • Members
  • PipPipPip
  • 99 posts
Here is the source code:
- Server
- Client
- email, this must be inside the folder where server is placed.
link copy-paste is required to open these pages on the browser.

#3
Alhazred

Alhazred

    Learning Programmer

  • Members
  • PipPipPip
  • 99 posts
I solved some problems... now I have a problem with the function "Leggi email" ("LeggiDaFile()" inside the server code) which should read an email on the server, the server should read a text file and send the content to the client, I can't do the last part. The server reads the file and fills the structured type but doesn't send it through the mailslot to the client, I have an "Access Denied" error.

Why does it happen? I set read/write flags.

Updated code is available at the links in the first post.

#4
Alhazred

Alhazred

    Learning Programmer

  • Members
  • PipPipPip
  • 99 posts
I found a reason why the problem could happen, messages sent from server must be less than 400 bytes and mine were 404 bytes.
Now the size of my messages has been changed to stay under 400 bytes, but still have problems.
It should be due to security attributes, I set NULL and it seems I have to set a security attribute structure. Unfortunatly can't understand how to do reading MSDN.
Can you help me?

Changed code linked in the first post.

Thanks :)