473,880 Members | 1,959 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Error in my code somewhere, i think ?

11 New Member
hi all,

ok this is what i am trying to do. log on and authenticate. i have written the code below which asks for a serial number, which then gets passed over to the server. for the moment i am just printing the number, which gives me the code

SOCKET INFO: accept left errorno 25 and new socket 4.

however before this code appeared the numbers did not match.

anyone got any tips on whats going on here?

oh and be kind to me and keep it simple please !




server

/* get user id from client */
recv_data(sock, box);
sprintf("your settopbox number is %ld\n",box);
close_socket(so ck);

client

printf("Please enter your SetTopBox Number\t");
scanf("%s",box) ;
printf("Please enter your Customer ID\t");
scanf("%s",id);
send_data(local _socket,box,str len(box)+1);
send_data(local _socket,id,strl en(id)+1);
Mar 23 '07 #1
5 1123
DeMan
1,806 Top Contributor
Could you please clarify where the numbers do not match (and how you know that they don't) - and please use code tags if posting code (use the word code to start and /code to finish both inside [ ])
Mar 23 '07 #2
fatboySudsy
11 New Member
hi the number that i put into the client for the settopbox, does not match the settopbox number printed on the server program.

i am hoping that the code listed below asks me for my settopbox number, which i store and then send to the server, the same applies for the customer id.

i then have the sprintf in the server to display the settopbox number.

Expand|Select|Wrap|Line Numbers
  1.  
  2. server
  3.  
  4. /* get user id from client */
  5. recv_data(sock,box);
  6. sprintf("your settopbox number is %ld\n",box);
  7. close_socket(sock);
  8.  
  9. client
  10.  
  11. printf("Please enter your SetTopBox Number\t");
  12. scanf("%s",box);
  13. printf("Please enter your Customer ID\t");
  14. scanf("%s",id);
  15. send_data(local_socket,box,strlen(box)+1);
  16. send_data(local_socket,id,strlen(id)+1);
  17.  
  18.  
Mar 23 '07 #3
DeMan
1,806 Top Contributor
I think the problem may be that you get the Set top box number as a string (array of characters) rather than a number (try scanf("%d\n" box)).
The characters "1234" are represtented different to the number 1234 internally.
I'm also not sure why you add one to the lengths you are sending....
Mar 23 '07 #4
fatboySudsy
11 New Member
ok well i tried that and it got rid of my error code ....

however if i type in the settopbox number as 123456789 it equals 536850328 and if i type in the customer id as 1234 it comes out as 536850344.

can you tell me why these numbers are misrepresented ?
Mar 23 '07 #5
DeMan
1,806 Top Contributor
I suspect you may need to take a reference from recv_data (that is &box), and possibly pass it that way to send also (I think the numbers you are geeting are memory references)
Mar 23 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

8
1685
by: STEPHEN GOODE | last post by:
I am getting the following error. I've changed the paths and file names here to protect my client's confidentiality. Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /www/html/app/includes/someincludescript.php:2) in /www/html/app/includes/session.php on line 3 The main script has
0
6185
by: Mike | last post by:
I'm using ASP and CDO to lookup free busy time on an e2k server. The E2K is locally installed on the IIS server and I'm having no problems accessing resources like public folders, mailboxes, etc. When I check Free Busy you have to access the Active Directory with LDAP. The Domain Controller is on another server. I am getting error 80005000 whenever I query LDAP. The following code works perfectly on a server that is a DC, but my...
30
2967
by: Neil Zanella | last post by:
Hello, Allow me to share my frustrations with GNU g++. This is the second time something similar happens to me: I can't find anything wrong with my C++ program and yet I get segfaults, and eventually, here is what happens. Anyone ever experience anything similar. This or similar untrackable problems happen to me whenever I write a large class... anyone have had similar experiences??? make
65
4103
by: Pmb | last post by:
I'm confused as to what the compiler error message I'm getting is refering to. Can someone take a gander and let me know what I did wrong? The program is below. When I compile it I get the following error ______________________________ Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland d:\temp\complex\temp.cpp: Error E2333 d:\temp\complex\temp.cpp 73: Class member 'Complex::conjugate(Complex)' declared outside its class Error...
3
1440
by: Marty McDonald | last post by:
If I try to validate this xml... <?xml version="1.0" encoding="utf-8" ?> <a:FuncalcParameters xmlns:a="http://www.somewhere.fun.com/Funcalc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.somewhere.fun.com/Funcalc http://localhost/FuncalcService/FuncalcParameters.xsd"> <TransId>D-288</TransId> <CalcType>CalculateARM</CalcType> <SR>5</SR> <RRT></RRT>
10
5815
by: DataBard007 | last post by:
Hello Access Gurus: I use Win98SE and Access97. I just built a simple Access97 application which holds all contact information for my personal contacts, such as first name, last name, address, city, state, etc. When the user wants to search for a particular record, he does two things: 1. On the form is a text box on which he enters the text he is searching for.
6
4607
by: José Joye | last post by:
Hello, I'm currently reading the MS Developing Web applications with c# (and VB.net). In the chapter related to Error management, there is a sample about "Page-Level Error Pages" eg: In my form: ========
13
2452
by: Max | last post by:
Hi There! I'm having a mysterious error right after I login using Forms Authentication in my ASP.NET app. Below is the error... Exception Details: System.NullReferenceException: Object reference not set to an instance of an object. The exception throws at the code that tries to set a property (String data type) at my Menu user control.
11
2604
by: Martin Joergensen | last post by:
Hi, I've encountered a really, *really*, REALLY strange error :-) I have a for-loop and after 8 runs I get strange results...... I mean: A really strange result.... I'm calculating temperatures. T = 20 degrees at all times.... The 2D T-array looks like this:
18
22430
by: robert | last post by:
Is there a ready made function in numpy/scipy to compute the correlation y=mx+o of an X and Y fast: m, m-err, o, o-err, r-coef,r-coef-err ? Or a formula to to compute the 3 error ranges? -robert PS: numpy.corrcoef computes only the bare coeff:
0
9925
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10713
jinu1996
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...
1
10809
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,...
0
9550
agi2029
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...
0
5777
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5972
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4595
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4192
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3219
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.