none
Simple Chat Application : Problem with Send/Receive chat data! RRS feed

  • Question

  • Hi
    In this thread, i'm working on a simple chat aplication which solved my problem.
    Now in my main project i'm facing a new problem! a chat data does not send/receive correctly.
    It look like, the first message received but not showing and other messages not receiving! to clarify my problem i've create a new project to reproduce my problem. please download from this link & follow these steps :

    1. Install service (This service listen on port 7031 & client apps connect to service via 127.0.0.1 & 7031)
    2. Run sample app (RaytebNetworkChat.exe) multiple times (for example 2 times), to simulate chat session on your local machine.
    Note : Please change userName field(s) for each app to different names.
    3. Clinc on 'Online Users' to display connected clients.
    4. Double click on target client which u want chat with.
    Note 1 : For better undesrtanding, please run first client app in debug mode, to debug received message.
    Note 2 : This project work with .net & vs 2015.

    Thanks in advance.

    http://www.codeproject.com/KB/codegen/DatabaseHelper.aspx

    Tuesday, September 24, 2019 8:50 PM

All replies

  • Hi Hamed_1983,

    Thank you for posting here.

    I have downloaded the project and installed the related service. I could send and receive message normally. You could check it again.

    Test Result:

    Best Regards,

    Jack


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, September 25, 2019 5:56 AM
    Moderator
  • Hi Jack

    Thanks for reply, please don't open the second chat form. just open the first side chat form and send a message, the second side chat form should be open automatically!

    Keep in mind, when first side send a message, it receive by second side (See this image), However in FrmMain form there is a if-else statement which query incoming connectionID in our dictionary, if exists, then send received message to it, If not exists, Querying onlineUsers to get userName of incoming connectionID, then open it's chat form. In your example, because you open 2 sides chat form, (As u seee in image) the yellow line runs, & if u do not open the second side chat form, the red line runs and make the problem!!!

    The problem is related to getting OnlineUsers which return empty dataTable after 10 seconds & i don't know why this not working in this place!

    Thanks in advance


    http://www.codeproject.com/KB/codegen/DatabaseHelper.aspx

    Wednesday, September 25, 2019 6:29 AM
  • Hi Hamed_1983,

    Thanks for the feedback.

    Based on my test, I find the second char form could not be opened automatically. Therefore, Please check it again.

    Best Regards,

    Jack


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, September 26, 2019 8:28 AM
    Moderator
  • Hi again Jack

    As i told in last post, because 'else' statements runs inside FrmMain, it's get a null dataTable after 10 seconds and hence does not have any data to open new chat from!


    http://www.codeproject.com/KB/codegen/DatabaseHelper.aspx

    Thursday, September 26, 2019 10:20 AM