Hi,
I've been having trouble recently with sending messages to a client.
The client seems to be recieving the sever output (in the console).
This has completely done me in.
I have noticed it is to do with the buffer size.
For example: -
send(client[i].clientsocket, "-h7-Endlist" , sizeof("-h7-Endlist"), 0); // is the previous send() call
-
send(client[i].clientsocket, client[id].clientname, sizeof(client[id].clientname), 0);
-
send(client[i].clientsocket, " signed in.\n" , sizeof(" signed in.\n") , 0);
Would send ' signed in.'.
And when I do somthing like this: -
send(client[i].clientsocket, "-h7-Endlist" , sizeof("-h7-Endlist "), 0); // is the previous send() call
-
send(client[i].clientsocket, " Says:\n" , 1000, 0);
-
send(client[i].clientsocket, client[id].buf , 1000, 0);
-
Would show something liek:
'beta 6
Adam signed in.'
Where 'beta 6' is displayed in the server console, and strangely gets put into send() function.
Also, this worked perfectly over a LAN connect, but not over a WAN connection.
All required ports are opend and forwarded properly.
Is this my cheesy scripting? or a fixable common error?
5 2210
Can someone please help me with this.
Banfa 9,065
Recognized Expert Moderator Expert
If the data is not getting there it is much more likely to be a connection error than a send error.
How did you connect? Was it successful (i.e. not returned errors or error callbacks)?
What were the return values of your send function calls?
Thanks for posting,
I never seemed to check for send errors, I see what they return...
Bit of a bump...
I made a flash client for it as well.
But, its very odd, it displays data that even hasnt been echoed by the server.
So, Most likely a send() error.
What is the best method of using send?
send(socket, "hello", sizeof "hello", 0),
send(socket, string, sizeof string, 0),
send(socket, "hello", 1000, 0),
or send(socket, string, 1000 , 0); ?
Please?
Could the environment affect its behaviour?
It works fine on local host, just not on another pc...
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Dom |
last post by:
I'm new to c++. Just started learning it 24 hours ago. Am running into a
compile problem. Please, no one waste the effort telling me to google it.
I've been researching it for quite a while with no joy. I got dev-c++ and a
bit of winsock sample code. I've done nothing out of the ordinary. I could
only assume that anyone else that downloaded this software and attempted
this would meet with the same result. The problem lies with either the...
|
by: windandwaves |
last post by:
Hi Folk
I proudly send my emails using John Rhoton's code for sending them directly
via winsock.
I now want to take this system to the next level and start sending emails
with HTML content. Does anyone have any experience in this area?
Thank you
|
by: Nadav |
last post by:
Hi,
Introduction:
*************************
I am developing communication infrastructure for a streaming video server,
to achieve optimal performance I use IO Completion ports & a thread pool in
combination with winsock MsAPI ( e.g. ConnectEx, AcceptEx, … ), sending data
through sockets is done with Read/WriteFile.
The problem:
|
by: Jefe |
last post by:
Hi Guyz
well I wanna implement a tcp chat program with C# and winsock, and I know
that I should use Asynchronous methods so my windows program won't be
blocked, but in my application both clients could send and receive messages
at the same time, which means I can not begin recieving after sending a
message or vice versa, it's possible that my application would recieve
multiple messages, so how should I handle that?
Regards,
|
by: Mark |
last post by:
Hi,
I have a VB6 project that uses a winsock control to receive text
messages over a UDP connection.
It used to work fine. However, when I changed the code to make it more
efficient (ie, less processing was done with each received message), the
program has this weird bug where it will stop acting on the messages
received. The program might work fine for a whole day, receiving
thousands of messages, so it is an intermittent problem.
| |
by: raj.rr7 |
last post by:
Hi,
I am creating a Http client application using winsock, evc++ 4.0 and K-
Jam (WIndows Mobile 5) that will get data from Http server. I am using
the following code.
WSADATA wsaData;
CString csErr;
memset(&wsaData, 0, sizeof(WSADATA));
|
by: danishce |
last post by:
Hello All:
I am developing a client/server application using vb.net winsock programming.
I am sending data to Server and at the same time receive the incoming data from the server.
My application have 3 Windows Forms.
1-FrmInquiry
2-FrmSale
3-FrmBalance
When i send and receive data from FrmInquiry to server it works fine but
My problem is when i go to any other form(ex FrmSale) from FrmInquiry and send data from it to server, it gives...
|
by: danishce |
last post by:
I am developing a client/server application using vb.net winsock programming.
I am sending data to Server and at the same time receive the incoming data from the server.
Everything works fine but when i goto next form and send data again to server it gives error.
Please help me?
|
by: imaloner |
last post by:
I am posting two threads because I have two different problems, but both have the same background information.
Common Background Information:
I am trying to rebuild code for a working, commercially sold application with only partial build instructions. The previous maintainer of the code (a
mixture of C and C++) is no longer with the company, but when he built the code he used MSVC++, and though I am not certain of the version he was ...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |