Home > Winsock Error > Winsock Error Handling Vb6

Winsock Error Handling Vb6

Unfortunately most of the errors that get routed here will result in you having to gracefully shutdown the multi-player system. Call Attach method first." End If m_bSendCompleted = False m_bSocketError = False m_socket.SendData sMessage & vbCrLf 'Wait until the message is sent or an error occurs' Do Until m_bSendCompleted Or m_bSocketError At this point we will disable the textbox so that the user can not change the port while we are waiting for the client to connect! Click here it's easy and free. Source

Great for personal to-do lists, project milestones, team priorities and launch plans. - Combine task lists, docs, spreadsheets, and chat in one - View and edit from mobile/offline - Cut down share|improve this answer answered Apr 27 '09 at 15:15 Keith Maurino 1,63562841 add a comment| up vote 0 down vote Why is the sub named Private Sub singleSock_SendCompleted() when the actual We have to add code into the Unload event that will ‘clean up’ the Winsock control. Your server is preparing to accept more connections. http://www.vbforums.com/showthread.php?477668-RESOLVED-winsock-error-handler

sckBadState 40006 Wrong protocol or connection state for the requested transaction or request. Finally, we will add the code that connects the client to the server: 1:  Private Sub cmdConnect_Click() 2:    Dim lngPort as Long 3:    Dim strIP as String 4: 5:    strIP = I renamed Winsock as Win.

  • An event is raised by the control so that you know when an important ‘event’ happens.
  • VB comes with two types of ActiveX controls: Intrinsic and ActiveX control.
  • All browsers know that the HTTP port is 80.[size=5][italic][blue][RED]i[/RED]nfidel[/blue][/italic][/size][code]$ select * from users where clue > 0no rows returned[/code] 0 · Share on Facebook Sign In or Register to comment.

Get 1:1 Help Now Advertise Here Enjoyed your answer? However, you still cannot send data yet. Small part of an INI parser What's this I hear about First Edition Unix being restored? APPLICATION -> “Sending Data Between Two Computers” This application will connect two computers together and then will transfer a message between the computers.

More aggressive error checking should be applied in a full-blown application, however the IP address must be stored as string and the Port must be stored as a “Long”. Winsock1.GetData s, vbString lblReceivedData = s & vbCrLf & Left$(lblReceivedData, 2048) End IfEnd SubThe complete program:Option ExplicitPrivate Sub cmdBind_Click() ' Set the communication properties Winsock1.RemoteHost = txtPeerMachine Winsock1.RemotePort = txtPeerPort One of the most popular ones is the Peer-to-Peer model. The server is a central computer that is responsible for linking the many computers together.

Or is there a better way of doing this: : : : Thanks: : : : [red]Good luck![/red]: [blue]Hackman[/blue]: : 0 · Share on Facebook infidel Member Posts: 2,900 February 2005 Line 3 accepts the client. Why is this?Thanks 0 · Share on Facebook jeripedo Member Posts: 68 February 2005 Corrct me If i'm wrong but i believe your not supposed to use these prots because they These range from improper action requests to buffer overruns due to flawed programming to...

Logged Print Pages: [1] Go Up « previous next » Computer Hope » Software » Computer programming » problem with simple chat program programmed with visual basic Old Forum Search The sending and receiving of data through a connection is not really a difficult feat, especially when you use the Winsock control. The Connect event is a signal that the connect request has been accepted and the connection is established. For these your program has a bug that is fatal, or perhaps you have failed to validate user-supplied data (port number in valid range, etc.).

sckInvalidArg 40014 The argument passed to a function was not in the correct format or in the specified range. http://itechnologysolutionsllc.com/winsock-error/winsock-error-6.php This method is preferred if you know that there is a specific line that may cause an error. Shouldn't one be able to send data now that they are connected? One question about your response that I have is where you say: "You can't use Listen, Connect, SendData, or set some of the other properties (RemoteHost, RemotePort, LocalPort) if you are

The most useful property for helping you detect errors before they occur is the .State property. All of intrinsic controls are preloaded when VB loads and are usually shown in the toolbox. At the moment, my winsock error handling routine consists of a variety of cleanup procedures, and a winsock.close. have a peek here A port is what the data goes through when it comes into the computer; it separates the data so that one program does not get another program’s data.

However, most clients vehemently deny doing anything of the sort. RESOLUTIONThe code must wait until the Connect event is fired before attempting to call the SendData or GetData methods. Login.

Just look at each one.

SendData can ONLY be called when connected or you will get an error. I'm confused now. [vb5 & starting to move to vb2008] I appreciate the help I get from everyone. This “ether” can cause many memory leaks. Some errors have to do with setting properties.

I'm un-confused again. http://support.microsoft.com/default.aspx?scid=kb;en-us;183987------: I had a small doubt about Winsock! Article by: Navneet In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. Check This Out Or is there a better way of doing this: : Thanks: [red]Good luck![/red][blue]Hackman[/blue] 0 · Share on Facebook eternities_end Member Posts: 13 February 2005 Thanks for that reply.Now that I have

For example, a machine that losses power or network connection or a machine that goes into sleep or hibernate mode. There are these two types because programmers want to ensure that the internal workings are not subject to a careless programmer two years down the road, but need a type of Every time your socket try to conect will be created a new object. Line 5 displays a message box so that the server knows that some one connected.                         NOTES: This program demonstrated the basic properties, methods and events in preparing a server application.

sckInProgress 10036 A blocking Winsock operation in progress. All that remains to be programmed is the code that accepts the connection. It's been quite a while since I've done winsock programming in VB6 but it seems to me like there were issues with having multiple sockets talking to one another inside of Why should one close winsock for this?

It is assumed that you would simply put error handling code immediately after the line that is suspect. You are consuming the event handling thread by sending the data and event with the DoEvents you aren't truely releasing the thread and there are threads that the winsock needs to So what happens here is that your Winsock1 writes data, and then snaps the socket closed and doesn't free up threading resources until the state of the socket has reached closed. Because if SendData should be closed before sending, then wouldn't the same be true about GetData?

sckAlreadyConnected 10056 Socket is already connected. To run the application, you’ll need to start the server on one computer. With Winsock you must determine what type of data will be sent and how it will be received. However this is very tedious to enact on a much larger scale, especially because sometimes the program will be sending non-user drive events.

Follow us